diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0d797dc4..a0d596db 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -16,7 +16,7 @@ jobs: strategy: matrix: os: [ubuntu-latest] - ruby-version: [2.6, 2.7, '3.0', 3.1, 3.2, head] + ruby-version: [2.7, '3.0', 3.1, 3.2, head] runs-on: ${{ matrix.os }} diff --git a/.gitignore b/.gitignore index 24049cfb..29027bfe 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ /tmp/ /dont_call_it_tmp/ /vendor/ +/.tool-versions diff --git a/CHANGELOG.md b/CHANGELOG.md index a6f33947..da5ad235 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,48 @@ # Changelog +## 1.31.2 + +* Updates rubocop to [1.52.4](https://github.com/rubocop/rubocop/releases/tag/v1.52.4) +* Updates standard-performance to [v1.2.1](https://github.com/standardrb/standard-performance/releases/tag/v1.2.1) + +## 1.31.1 + +* Updates rubocop to [1.52.2](https://github.com/rubocop/rubocop/releases/tag/v1.52.2) + +## 1.31.0 + +* Updates standard-performance to [v1.2.0](https://github.com/standardrb/standard-performance/releases/tag/v1.2.0) +* Updates rubocop to [1.56.0](https://github.com/rubocop/rubocop/releases/tag/v1.56.0) + +## 1.30.1 + +* Just kidding about about `Standard::PluginSupport`. Moving it to `LintRoller::Support` +to avoid circular dependencies between Standard Ruby and its plugins + +## 1.30.0 + +* Add `Standard::PluginSupport` module of classes designed to make it a little +easier to author plugins. `MergesUpstreamMetadata#merge` will allow a minimal +YAML config (say, `standard-sorbet`'s, which only contains `Enabled` values for +each rule) to merge in any other defaults from a source YAML (e.g. +`rubocop-sorbet`'s which includes `Description`, `VersionAdded`, and so on). +This way that metadata is neither absent at runtime nor duplicated in a standard +plugin that mirrors a rubocop extension + +## 1.29.0 + +* Updates standard-performance to [1.1.0](https://github.com/standardrb/standard-performance/releases/tag/v1.1.0) +* Updates rubocop to [1.52.0](https://github.com/rubocop/rubocop/releases/tag/v1.52.0) + * Enables Style/ExactRegexpMatch, Style/RedundantArrayConstructor, Style/RedundantFilterChain, Style/RedundantRegexpConstructor + +## 1.28.5 + +* Make LSP behave more nicely with nvim-lspconfig [#564](https://github.com/standardrb/standard/pull/564) + +## 1.28.4 + +* Fix [standard-rails#7](https://github.com/standardrb/standard-rails/issues/7#issuecomment-1563505365) + ## 1.28.3 * Older ruby support fixes from [@pboling](https://github.com/pboling): diff --git a/Gemfile.lock b/Gemfile.lock index ccc4d465..b4eb719a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,47 +1,52 @@ PATH remote: . specs: - standard (1.28.3) + standard (1.31.2) language_server-protocol (~> 3.17.0.2) lint_roller (~> 1.0) - rubocop (~> 1.50.2) + rubocop (~> 1.56.4) standard-custom (~> 1.0.0) - standard-performance (~> 1.0.1) + standard-performance (~> 1.2) GEM remote: https://rubygems.org/ specs: ast (2.4.2) + base64 (0.1.1) docile (1.4.0) gimme (0.5.0) json (2.6.3) language_server-protocol (3.17.0.3) - lint_roller (1.0.0) - m (1.6.1) + lint_roller (1.1.0) + m (1.6.2) method_source (>= 0.6.7) rake (>= 0.9.2.2) method_source (1.0.0) - minitest (5.18.0) + minitest (5.20.0) parallel (1.23.0) - parser (3.2.2.1) + parser (3.2.2.4) ast (~> 2.4.1) + racc + racc (1.7.1) rainbow (3.1.1) rake (13.0.6) - regexp_parser (2.8.0) - rexml (3.2.5) - rubocop (1.50.2) + regexp_parser (2.8.2) + rexml (3.2.6) + rubocop (1.56.4) + base64 (~> 0.1.1) json (~> 2.3) + language_server-protocol (>= 3.17.0) parallel (~> 1.10) - parser (>= 3.2.0.0) + parser (>= 3.2.2.3) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 1.8, < 3.0) rexml (>= 3.2.5, < 4.0) - rubocop-ast (>= 1.28.0, < 2.0) + rubocop-ast (>= 1.28.1, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 2.4.0, < 3.0) - rubocop-ast (1.28.1) + rubocop-ast (1.29.0) parser (>= 3.2.1.0) - rubocop-performance (1.16.0) + rubocop-performance (1.19.1) rubocop (>= 1.7.0, < 2.0) rubocop-ast (>= 0.4.0) ruby-progressbar (1.13.0) @@ -51,12 +56,13 @@ GEM simplecov_json_formatter (~> 0.1) simplecov-html (0.12.3) simplecov_json_formatter (0.1.4) - standard-custom (1.0.0) + standard-custom (1.0.2) lint_roller (~> 1.0) - standard-performance (1.0.1) - lint_roller (~> 1.0) - rubocop-performance (~> 1.16.0) - unicode-display_width (2.4.2) + rubocop (~> 1.50) + standard-performance (1.2.1) + lint_roller (~> 1.1) + rubocop-performance (~> 1.19.1) + unicode-display_width (2.5.0) PLATFORMS ruby diff --git a/README.md b/README.md index 7f6baa12..346653dc 100644 --- a/README.md +++ b/README.md @@ -155,7 +155,7 @@ We've added a number of editing guides for getting started: - [vim](https://github.com/standardrb/standard/wiki/IDE:-vim) - [neovim](https://github.com/standardrb/standard/wiki/IDE:-neovim) - [RubyMine](https://www.jetbrains.com/help/ruby/rubocop.html#disable_rubocop) -- [emacs](https://github.com/julianrubisch/flycheck-standardrb) +- [emacs](https://www.flycheck.org/en/latest/languages.html#syntax-checker-ruby-standard) - [Atom](https://github.com/standardrb/standard/wiki/IDE:-Atom) If you'd like to help by creating a guide, please draft one [in an @@ -450,12 +450,14 @@ default rulesets, just as you would any other gem: ```yaml require: - standard + - standard-custom + - standard-performance - rubocop-performance inherit_gem: standard: config/base.yml - standard-performance: config/base.yml standard-custom: config/base.yml + standard-performance: config/base.yml ``` ## Who uses Standard Ruby? @@ -463,10 +465,12 @@ inherit_gem: Here are a few examples of Ruby Standard-compliant teams & projects: * [Test Double](https://testdouble.com/agency) +* [AlchemyCMS](https://alchemy-cms.com) * [Amazon Web Services](https://aws.amazon.com/) * [Arrows](https://arrows.to/) * [Avo Admin](https://avohq.io/) * [Babylist](https://www.babylist.com/) +* [BLISH](https://blish.cloud) * [Brand New Box](https://brandnewbox.com) * [Brave Software](https://github.com/brave-intl/publishers) * [Collective Idea](https://collectiveidea.com/) @@ -504,6 +508,38 @@ If you really want to show off, you can also add a badge to your project's READM [![Ruby Code Style](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://github.com/standardrb/standard) ``` +## Help, I'm seeing an install error! + +This section is really only here to feed Google, but if you see an error like +any of the following: + +``` +ERROR: Could not find a valid gem 'standard' (= 0.0.36) in any repository +``` + +``` +Could not find gem 'standard (= 0.0.36)' in rubygems repository https://rubygems.org/ or installed locally. +``` + +``` +Your bundle is locked to standard (0.0.36) from rubygems repository https://rubygems.org/ or installed locally, but that version can no longer be found in that source. That means the author of standard (0.0.36) has removed it. You'll need to update your bundle to a version other than standard (0.0.36) that hasn't been removed in order to install. +``` + +This is because on August 18th, 2023, we yanked versions 0.0.1~0.0.36.1 from +[RubyGems.org](https://rubygems.org) for the reasons discussed in [this +issue](https://github.com/standardrb/standard/issues/340). Because these +versions are now over four years old and no longer track supported versions of +Ruby or RuboCop, the correct fix for any of the above errors is probably to +**upgrade to the latest version of Standard Ruby**. + +If for whatever reason you need to install one of these versions, you can +change your Gemfile to point to the corresponding git tag from the source +repository: + +```ruby +gem "standard", git: "https://github.com/testdouble/standard.git", tag: "v0.0.36" +``` + ## Code of Conduct This project follows Test Double's [code of diff --git a/config/base.yml b/config/base.yml index 203ae42c..ccdf8112 100644 --- a/config/base.yml +++ b/config/base.yml @@ -5,6 +5,9 @@ Bundler/DuplicatedGem: - '**/Gemfile' - '**/gems.rb' +Bundler/DuplicatedGroup: + Enabled: false + Bundler/GemComment: Enabled: false @@ -602,6 +605,9 @@ Lint/MissingCopEnableDirective: Lint/MissingSuper: Enabled: false +Lint/MixedCaseRange: + Enabled: true + Lint/MixedRegexpCaptureTypes: Enabled: true @@ -668,6 +674,9 @@ Lint/RedundantCopEnableDirective: Lint/RedundantDirGlobSort: Enabled: false +Lint/RedundantRegexpQuantifiers: + Enabled: true + Lint/RedundantRequireStatement: Enabled: true @@ -964,7 +973,6 @@ Style/AndOr: Style/ArgumentsForwarding: Enabled: true - AllowOnlyRestArgument: true Style/ArrayCoercion: Enabled: false @@ -1153,6 +1161,8 @@ Style/EvalWithLocation: Style/EvenOdd: Enabled: false +Style/ExactRegexpMatch: + Enabled: true Style/ExpandPathArguments: Enabled: false @@ -1498,6 +1508,9 @@ Style/RandomWithOffset: Style/RedundantArgument: Enabled: false +Style/RedundantArrayConstructor: + Enabled: true + Style/RedundantAssignment: Enabled: true @@ -1516,6 +1529,9 @@ Style/RedundantConditional: Style/RedundantConstantBase: Enabled: false +Style/RedundantCurrentDirectoryInPath: + Enabled: true + Style/RedundantDoubleSplatHashBraces: Enabled: true @@ -1531,6 +1547,9 @@ Style/RedundantFetchBlock: Style/RedundantFileExtensionInRequire: Enabled: true +Style/RedundantFilterChain: + Enabled: false + Style/RedundantFreeze: Enabled: true @@ -1552,9 +1571,15 @@ Style/RedundantParentheses: Style/RedundantPercentQ: Enabled: true +Style/RedundantRegexpArgument: + Enabled: true + Style/RedundantRegexpCharacterClass: Enabled: true +Style/RedundantRegexpConstructor: + Enabled: true + Style/RedundantRegexpEscape: Enabled: true @@ -1596,6 +1621,9 @@ Style/RescueStandardError: Style/ReturnNil: Enabled: false +Style/ReturnNilInPredicateMethodDefinition: + Enabled: false + Style/SafeNavigation: Enabled: true ConvertCodeThatCanStartToReturnNil: false @@ -1760,7 +1788,8 @@ Style/UnlessElse: Enabled: true Style/UnlessLogicalOperators: - Enabled: false + Enabled: true + EnforcedStyle: forbid_mixed_logical_operators Style/UnpackFirst: Enabled: true @@ -1780,6 +1809,9 @@ Style/WhileUntilModifier: Style/WordArray: Enabled: false +Style/YAMLFileRead: + Enabled: true + Style/YodaCondition: Enabled: true EnforcedStyle: forbid_for_all_comparison_operators diff --git a/config/ruby-1.9.yml b/config/ruby-1.9.yml index e4313fc4..af3f3b7b 100644 --- a/config/ruby-1.9.yml +++ b/config/ruby-1.9.yml @@ -5,3 +5,7 @@ Style/Encoding: Style/HashConversion: Enabled: false + +# Percent delimiters are not supported until Ruby 2.0 +Style/PercentLiteralDelimiters: + Enabled: false diff --git a/config/ruby-3.1.yml b/config/ruby-3.1.yml index a7a199ec..844f873c 100644 --- a/config/ruby-3.1.yml +++ b/config/ruby-3.1.yml @@ -5,3 +5,7 @@ AllCops: Style/DataInheritance: Enabled: false + +Style/ArgumentsForwarding: + Enabled: true + AllowOnlyRestArgument: true diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.md index 7d29e257..c5d5f727 100644 --- a/docs/ARCHITECTURE.md +++ b/docs/ARCHITECTURE.md @@ -8,7 +8,9 @@ buried. Starting with version 1.28.0, Standard Ruby introduced plugin support and refactored how it loads its own rules from one large YAML file into several plugins. As a result, what was a single `standard` gem is now spread across 3 -gems. Here's how it's all organized: +gems. + +Here's how it's all organized: * [standard](https://github.com/standardrb/standard) - The main gem. The one people install and think of. Because `standard` has a hard dependency on `rubocop`, diff --git a/docs/UPGRADING.md b/docs/UPGRADING.md new file mode 100644 index 00000000..251e8879 --- /dev/null +++ b/docs/UPGRADING.md @@ -0,0 +1,31 @@ +# Upgrading Standard + +Since standard now encompasses both a tool itself and a series of plug-ins it makes sense to first update the standard plug-ins and then the standard tool itself. Each plug-in is a configuration for its corresponding rubocop plug-in. + +The official standard plug-ins that are included in standard are: + +- **Standard Performance:** corresponding to rubocop-performance +- **Standard Custom:** for custom cops created for standard + +## Updating Standard Plugins + +1. Update Rubocop plugin in the gemspec file and gem file. +1. Keep standard in the gem file up-to-date. This will bring any testing utilities in standard into the plug-in repository. +1. Run bundle exec rake to run the tests +1. Configure any cops that need to be configured so that the tests pass +1. Update the change log to the best of your ability and title it as unreleased +1. Make your commit for these updates and push to the main branch +1. Update the version in version.rb and update the version in the Changelog replacing the word “Unreleased” +1. Run bundle to write the new version number to the lock file +1. Run bundle exec release to release the gem to RubyGems and create the version git tag. Push the tag to GitHub. + +## Updating Standard + +1. Update Rubocop as well as Standard Performance in the gemspec file and gem file. +1. Run bundle exec rake to run the tests +1. Configure any cops that need to be configured so that the tests pass +1. Update the change log to the best of your ability and title it as unreleased +1. Make your commit for these updates and push to the main branch +1. Update the version in version.rb and update the version in the Changelog replacing the word “Unreleased” +1. Run bundle to write the new version number to the lock file +1. Run bundle exec release to release the gem to RubyGems and create the version git tag. Push the tag to GitHub. diff --git a/lib/standard.rb b/lib/standard.rb index 668e902e..ac476341 100644 --- a/lib/standard.rb +++ b/lib/standard.rb @@ -11,6 +11,5 @@ module Standard require "standard/railtie" if defined?(Rails) && defined?(Rails::Railtie) require "standard/formatter" -require "standard/cop/block_single_line_braces" require "standard/plugin" diff --git a/lib/standard/creates_config_store.rb b/lib/standard/creates_config_store.rb index 34e27d25..47001c01 100644 --- a/lib/standard/creates_config_store.rb +++ b/lib/standard/creates_config_store.rb @@ -19,9 +19,9 @@ def call(standard_config) RuboCop::ConfigStore.new.tap do |config_store| options_config = @assigns_rubocop_yaml.call(config_store, standard_config) @sets_target_ruby_version.call(options_config, standard_config) - @configures_ignored_paths.call(options_config, standard_config) @combines_plugin_configs.call(options_config, standard_config) @merges_user_config_extensions.call(options_config, standard_config) + @configures_ignored_paths.call(options_config, standard_config) end end end diff --git a/lib/standard/lsp/routes.rb b/lib/standard/lsp/routes.rb index 8cd58773..3afad197 100644 --- a/lib/standard/lsp/routes.rb +++ b/lib/standard/lsp/routes.rb @@ -27,7 +27,10 @@ def for(name) @writer.write(id: request[:id], result: Proto::Interface::InitializeResult.new( capabilities: Proto::Interface::ServerCapabilities.new( document_formatting_provider: true, - diagnostic_provider: true, + diagnostic_provider: LanguageServer::Protocol::Interface::DiagnosticOptions.new( + inter_file_dependencies: false, + workspace_diagnostics: false + ), text_document_sync: Proto::Interface::TextDocumentSyncOptions.new( change: Proto::Constant::TextDocumentSyncKind::FULL, open_close: true @@ -75,6 +78,10 @@ def for(name) @writer.write({id: request[:id], result: format_file(uri)}) end + handle "workspace/didChangeConfiguration" do |_request| + @logger.puts "Ignoring workspace/didChangeConfiguration" + end + handle "workspace/didChangeWatchedFiles" do |request| if request[:params][:changes].any? { |change| change[:uri].end_with?(".standard.yml") } @logger.puts "Configuration file changed; restart required" diff --git a/lib/standard/version.rb b/lib/standard/version.rb index 6078cb21..5dab983c 100644 --- a/lib/standard/version.rb +++ b/lib/standard/version.rb @@ -1,3 +1,3 @@ module Standard - VERSION = Gem::Version.new("1.28.3") + VERSION = Gem::Version.new("1.31.2") end diff --git a/standard.gemspec b/standard.gemspec index 229a33b5..c8f6a333 100644 --- a/standard.gemspec +++ b/standard.gemspec @@ -23,11 +23,11 @@ Gem::Specification.new do |spec| spec.require_paths = ["lib"] spec.metadata["rubygems_mfa_required"] = "true" - spec.add_dependency "rubocop", "~> 1.50.2" + spec.add_dependency "rubocop", "~> 1.56.4" spec.add_dependency "lint_roller", "~> 1.0" spec.add_dependency "standard-custom", "~> 1.0.0" - spec.add_dependency "standard-performance", "~> 1.0.1" + spec.add_dependency "standard-performance", "~> 1.2" # not semver: first three are lsp protocol version, last is patch spec.add_dependency "language_server-protocol", "~> 3.17.0.2" diff --git a/test/fixture/config/rubocop_runner/.rubocop.yml b/test/fixture/config/rubocop_runner/.rubocop.yml new file mode 100644 index 00000000..050a1f38 --- /dev/null +++ b/test/fixture/config/rubocop_runner/.rubocop.yml @@ -0,0 +1,2 @@ +AllCops: + TargetRubyVersion: 2.7 diff --git a/test/fixture/config/u/.standard.yml b/test/fixture/config/u/.standard.yml index 8aeab28a..8b6287b7 100644 --- a/test/fixture/config/u/.standard.yml +++ b/test/fixture/config/u/.standard.yml @@ -2,8 +2,8 @@ ignore: - none_todo_path/**/* - none_todo_file.rb - thing.rb: - - Lint/Style - - Lint/UselessAssignment + - Lint/Style + - Lint/UselessAssignment - stuff.rb: - - Lint/Style - - Metric/LineLength \ No newline at end of file + - Lint/Style + - Metric/LineLength diff --git a/test/fixture/plugins/project/lib/banana/plugin.rb b/test/fixture/plugins/project/lib/banana/plugin.rb index 8d385aad..dfd68b84 100644 --- a/test/fixture/plugins/project/lib/banana/plugin.rb +++ b/test/fixture/plugins/project/lib/banana/plugin.rb @@ -17,6 +17,7 @@ def rules(context) "PreferredBananaReplacement" => @config["preferred_banana_replacement"] }, "Bananas/BananaBomb" => { + "Exclude" => ["nothinglolwtf"], "Enabled" => true } } diff --git a/test/standard/base_test.rb b/test/standard/base_test.rb index f9d8e304..3e5d30a1 100644 --- a/test/standard/base_test.rb +++ b/test/standard/base_test.rb @@ -23,15 +23,15 @@ def test_configures_all_rubocop_cops end end - assert_equal missing, [], "Configure these cops as either Enabled: true or Enabled: false in #{BASE_CONFIG}" - assert_equal extra, [], "These cops do not exist and should not be configured in #{BASE_CONFIG}" + assert_equal [], missing, "Configure these cops as either Enabled: true or Enabled: false in #{BASE_CONFIG}" + assert_equal [], extra, "These cops do not exist and should not be configured in #{BASE_CONFIG}" end def test_alphabetized_config actual = YAML.load_file(BASE_CONFIG).keys - ["require"] expected = actual.sort - assert_equal actual, expected, "Cop names should be alphabetized! (See this script to do it for you: https://github.com/standardrb/standard/pull/222#issue-744335213 )" + assert_equal expected, actual, "Cop names should be alphabetized! (See this script to do it for you: https://github.com/standardrb/standard/pull/222#issue-744335213 )" end private diff --git a/test/standard/plugin/merges_plugins_into_rubocop_config_test.rb b/test/standard/plugin/merges_plugins_into_rubocop_config_test.rb index edbb8143..064823d8 100644 --- a/test/standard/plugin/merges_plugins_into_rubocop_config_test.rb +++ b/test/standard/plugin/merges_plugins_into_rubocop_config_test.rb @@ -84,11 +84,13 @@ def test_accepts_both_object_and_path_plugins_and_first_in_wins_without_merge "AllCops" => {} }, "") - @subject.call(options_config, {}, [ - PathyPlugin.new("test/fixture/plugins/rules.yml"), - ObjectyPlugin.new("Fake/Things" => {"Enabled" => true, "Dingus" => "never", "Really" => false}, "Fake/Junk" => {"Enabled" => false}), - ObjectyPlugin.new("Fake/Crap" => {"Enabled" => true}) - ], permit_merging: true) + capture_io do + @subject.call(options_config, {}, [ + PathyPlugin.new("test/fixture/plugins/rules.yml"), + ObjectyPlugin.new("Fake/Things" => {"Enabled" => true, "Dingus" => "never", "Really" => false}, "Fake/Junk" => {"Enabled" => false}), + ObjectyPlugin.new("Fake/Crap" => {"Enabled" => true}) + ], permit_merging: true) + end assert_equal({ "AllCops" => {}, @@ -135,24 +137,26 @@ def test_that_first_person_to_set_a_rule_cant_have_the_nested_attributes_overrid } }, "") - @subject.call(options_config, {}, [ - ObjectyPlugin.new( - "Breakfast/Eggs" => { - "Enabled" => true, - "EnforcedStyle" => "scrambled" - } - ), - ObjectyPlugin.new( - "Breakfast/Eggs" => { - "EnforcedStyle" => "poached" - } - ), - ObjectyPlugin.new( - "Breakfast/Eggs" => { - "Salt" => true - } - ) - ], permit_merging: true) + capture_io do + @subject.call(options_config, {}, [ + ObjectyPlugin.new( + "Breakfast/Eggs" => { + "Enabled" => true, + "EnforcedStyle" => "scrambled" + } + ), + ObjectyPlugin.new( + "Breakfast/Eggs" => { + "EnforcedStyle" => "poached" + } + ), + ObjectyPlugin.new( + "Breakfast/Eggs" => { + "Salt" => true + } + ) + ], permit_merging: true) + end assert_equal({ "AllCops" => {}, @@ -171,11 +175,13 @@ def test_that_first_person_to_set_an_allcop_setting_wins_it_but_not_disallowed_o } }, "") - @subject.call(options_config, {}, [ - ObjectyPlugin.new("AllCops" => {"A" => "a1", "B" => "b1", "C" => "c1"}), - ObjectyPlugin.new("AllCops" => {"A" => "a2", "B" => "b2", "C" => "c2", "D" => "d2"}), - ObjectyPlugin.new("AllCops" => {"E" => "e3"}) - ], permit_merging: true) + capture_io do + @subject.call(options_config, {}, [ + ObjectyPlugin.new("AllCops" => {"A" => "a1", "B" => "b1", "C" => "c1"}), + ObjectyPlugin.new("AllCops" => {"A" => "a2", "B" => "b2", "C" => "c2", "D" => "d2"}), + ObjectyPlugin.new("AllCops" => {"E" => "e3"}) + ], permit_merging: true) + end assert_equal({ "AllCops" => {"A" => "a1", "B" => "b1", "C" => "c1", "D" => "d2", "E" => "e3"} @@ -199,14 +205,16 @@ def test_that_all_cops_arrays_are_concated_but_rule_arrays_are_overwritten } }, "") - @subject.call(options_config, {}, [ - ObjectyPlugin.new("AllCops" => {"fruits" => ["banana"]}), - ObjectyPlugin.new("AllCops" => {"nuts" => []}), - ObjectyPlugin.new("AllCops" => {"fruits" => []}, "Some/Rule" => {"candies" => ["lollipop"]}), - ObjectyPlugin.new("AllCops" => {"fruits" => ["tomato", "orange"]}), - ObjectyPlugin.new("AllCops" => {"nuts" => ["cashew"]}, "Some/Rule" => {"candies" => ["suckers", "gum"]}), - ObjectyPlugin.new("AllCops" => {"nuts" => ["peanut", "cashew"]}) - ], permit_merging: true) + capture_io do + @subject.call(options_config, {}, [ + ObjectyPlugin.new("AllCops" => {"fruits" => ["banana"]}), + ObjectyPlugin.new("AllCops" => {"nuts" => []}), + ObjectyPlugin.new("AllCops" => {"fruits" => []}, "Some/Rule" => {"candies" => ["lollipop"]}), + ObjectyPlugin.new("AllCops" => {"fruits" => ["tomato", "orange"]}), + ObjectyPlugin.new("AllCops" => {"nuts" => ["cashew"]}, "Some/Rule" => {"candies" => ["suckers", "gum"]}), + ObjectyPlugin.new("AllCops" => {"nuts" => ["peanut", "cashew"]}) + ], permit_merging: true) + end assert_equal({ "AllCops" => { diff --git a/test/standard/runners/lsp_test.rb b/test/standard/runners/lsp_test.rb index fc443915..4d013baf 100644 --- a/test/standard/runners/lsp_test.rb +++ b/test/standard/runners/lsp_test.rb @@ -18,7 +18,7 @@ def test_server_initializes_and_responds_with_proper_capabilities result: {capabilities: { textDocumentSync: {openClose: true, change: 1}, documentFormattingProvider: true, - diagnosticProvider: true + diagnosticProvider: {interFileDependencies: false, workspaceDiagnostics: false} }}, jsonrpc: "2.0" } diff --git a/test/standard/runners/rubocop_test.rb b/test/standard/runners/rubocop_test.rb index fea3cb88..ad19e0f4 100644 --- a/test/standard/runners/rubocop_test.rb +++ b/test/standard/runners/rubocop_test.rb @@ -87,6 +87,8 @@ def test_print_corrected_output_on_stdin_with_corrections_on_stderr def create_config(options = {}, path = "test/fixture/runner/agreeable.rb") Standard::Config.new(nil, [path], DEFAULT_OPTIONS.merge(options), - RuboCop::ConfigStore.new) + RuboCop::ConfigStore.new.tap do |config_store| + config_store.options_config = Pathname.new(__dir__).join("../../fixture/config/rubocop_runner/.rubocop.yml") + end) end end diff --git a/test/standardrb_test.rb b/test/standardrb_test.rb index d1803d82..3dc4a17e 100644 --- a/test/standardrb_test.rb +++ b/test/standardrb_test.rb @@ -19,6 +19,7 @@ def test_project_a_failure_output lib/foo/do_lint.rb:1:1: Lint/UselessAssignment: Useless assignment to variable - `useless_assignment`. lib/foo/meh/do_lint.rb:1:1: Lint/UselessAssignment: Useless assignment to variable - `useless_assignment`. lib/do_lint.rb:1:1: Lint/UselessAssignment: Useless assignment to variable - `useless_assignment`. + standard: Run `standardrb --fix` to fix up to 3 problems. MSG end @@ -45,6 +46,7 @@ def test_project_with_cwd_in_nested_path #{standard_greeting} do_lint.rb:1:1: Lint/UselessAssignment: Useless assignment to variable - `useless_assignment`. meh/do_lint.rb:1:1: Lint/UselessAssignment: Useless assignment to variable - `useless_assignment`. + standard: Run `standardrb --fix` to fix up to 2 problems. MSG end