From 6849df52f863e3a41240503fbf9289cd378ebba5 Mon Sep 17 00:00:00 2001 From: Ivo Anjo Date: Tue, 23 Jul 2024 12:02:17 +0100 Subject: [PATCH] Redo standardrb integration by excluding every non-profiling file in `.standard_todo.yml` Thanks for the great suggestion @lloeki; this approach does seem to be a bit cleaner and future-proof. --- .circleci/config.yml | 2 +- .standard_todo.yml | 32 ++++++++++++++++++++++++++++++++ Rakefile | 20 +++----------------- 3 files changed, 36 insertions(+), 18 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 83d0bd8e28c..7efeec46ea3 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -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 diff --git a/.standard_todo.yml b/.standard_todo.yml index b70cea5db31..4a0f29d51f5 100644 --- a/.standard_todo.yml +++ b/.standard_todo.yml @@ -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 diff --git a/Rakefile b/Rakefile index c02a2264acc..590eddbeffe 100644 --- a/Rakefile +++ b/Rakefile @@ -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' @@ -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']