Skip to content

Commit

Permalink
Redo standardrb integration by excluding every non-profiling file in …
Browse files Browse the repository at this point in the history
…`.standard_todo.yml`

Thanks for the great suggestion @lloeki; this approach does seem to
be a bit cleaner and future-proof.
  • Loading branch information
ivoanjo committed Jul 23, 2024
1 parent 2c5cbbc commit 6849df5
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ step_standardrb: &step_standardrb
# Currently it always return 18 physical processors and 36 threads, regardless of executor size.
# The workaround is to use `cpu.shares / 1024`:
# https://discuss.circleci.com/t/environment-variable-set-to-the-number-of-available-cpus/32670/4
command: PARALLEL_PROCESSOR_COUNT=$((`cat /sys/fs/cgroup/cpu/cpu.shares` / 1024)) bundle exec rake standardrb_datadog:default
command: PARALLEL_PROCESSOR_COUNT=$((`cat /sys/fs/cgroup/cpu/cpu.shares` / 1024)) bundle exec rake standard
step_appraisal_install: &step_appraisal_install
run:
name: Install Appraisal gems
Expand Down
32 changes: 32 additions & 0 deletions .standard_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,38 @@
# Remove from this list as you refactor files.
---
ignore:
# This disables standardrb for the rest of dd-trace-rb (other than profiling)
- .pryrc
- .simplecov
- Appraisals
- datadog.gemspec
- Gemfile
- Rakefile
- Steepfile
- appraisal/**/**
- benchmarks/**/**
- gemfiles/**/**
- integration/**/**
- lib-injection/**/**
- lib/*
- lib/datadog/*
- lib/datadog/appsec/**/**
- lib/datadog/core/**/**
- lib/datadog/kit/**/**
- lib/datadog/opentelemetry/**/**
- lib/datadog/tracing/**/**
- spec/*
- spec/datadog/*
- spec/datadog/appsec/**/**
- spec/datadog/benchmark/**/**
- spec/datadog/core/**/**
- spec/datadog/kit/**/**
- spec/datadog/tracing/**/**
- spec/support/**/**
- tasks/**/**
- yard/**/**

# These profiling ignores are ALL going to be fixed in separate PRs
- lib/datadog/profiling/collectors/code_provenance.rb:
- Style/StringLiterals
- Style/TrailingCommaInArguments
Expand Down
20 changes: 3 additions & 17 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
require 'bundler/gem_tasks'
require 'datadog/version'
require 'rubocop/rake_task' if Gem.loaded_specs.key? 'rubocop'
require 'standard/rake' if Gem.loaded_specs.key? 'standard'
require 'rspec/core/rake_task'
require 'rake/extensiontask'
require 'yard'
Expand Down Expand Up @@ -415,23 +416,8 @@ namespace :native_dev do
CLEAN.concat(NATIVE_CLEAN)
end

namespace :standardrb_datadog do
desc 'Validate style using standardrb (profiling only)'
task :profiling do
sh 'standardrb lib/datadog/profiling* spec/datadog/profiling* ext/' if Gem.loaded_specs.key? 'standard'
end

desc 'Autofix style using standardrb (profiling only)'
task :profiling_autofix do
sh 'standardrb --fix lib/datadog/profiling* spec/datadog/profiling* ext/' if Gem.loaded_specs.key? 'standard'
end

desc 'Validate style using standardrb (temporary until full adoption)'
task default: ['profiling']
end

desc 'Runs rubocop + main test suite'
task default: ['rubocop', 'standardrb_datadog:default', 'typecheck', 'spec:main']
task default: ['rubocop', 'standard', 'typecheck', 'spec:main']

desc 'Runs the default task in parallel'
multitask fastdefault: ['rubocop', 'standardrb_datadog:default', 'typecheck', 'spec:main']
multitask fastdefault: ['rubocop', 'standard', 'typecheck', 'spec:main']

0 comments on commit 6849df5

Please sign in to comment.