Skip to content

standard-1-37-0 #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Dec 4, 2024
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ RUN adduser -u 9000 -g 9000 -D app
COPY Gemfile Gemfile.lock /usr/src/app/

RUN apk add --update build-base && \
gem install bundler && \
gem install bundler -v 2.4.22 && \
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixes issue running make image

The last version of bundler (>= 0) to support your Ruby & RubyGems was 2.4.22. Try installing it with `gem install bundler -v 2.4.22

bundle install --quiet -j 4 --without=test && \
chown -R app:app /usr/local/bundle && \
rm -fr ~/.gem ~/.bundle ~/.wh..gem && \
Expand Down
4 changes: 2 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ source "https://rubygems.org"

gem "activesupport", require: false
gem "mry", "~> 0.52.0", require: false
gem "parser", "~> 3.0.2"
gem "parser", "~> 3.3.0"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

required in order to satisfy gem dependencies

gem "pry", require: false
gem "safe_yaml"
gem "standard", "~> 1.4", require: false
gem "standard", "1.37.0", require: false
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hardlocked without twiddle wakka to emphasize this is the last version before ruby 3 is a minimum requirement for standard


group :test do
gem "rake"
Expand Down
60 changes: 38 additions & 22 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,25 @@ GEM
diff-lcs (1.4.4)
i18n (1.8.10)
concurrent-ruby (~> 1.0)
json (2.8.2)
language_server-protocol (3.17.0.3)
lint_roller (1.1.0)
method_source (1.0.0)
minitest (5.14.4)
mry (0.52.0.0)
rubocop (>= 0.41.0)
parallel (1.21.0)
parser (3.0.3.1)
parallel (1.26.3)
parser (3.3.6.0)
ast (~> 2.4.1)
racc
pry (0.14.1)
coderay (~> 1.1)
method_source (~> 1.0)
rainbow (3.0.0)
racc (1.8.1)
rainbow (3.1.1)
rake (13.0.6)
regexp_parser (2.1.1)
rexml (3.2.5)
regexp_parser (2.9.2)
rexml (3.3.9)
rspec (3.10.0)
rspec-core (~> 3.10.0)
rspec-expectations (~> 3.10.0)
Expand All @@ -40,28 +45,39 @@ GEM
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.10.0)
rspec-support (3.10.2)
rubocop (1.22.3)
rubocop (1.64.1)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
parser (>= 3.0.0.0)
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml
rubocop-ast (>= 1.12.0, < 2.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.31.1, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 3.0)
rubocop-ast (1.13.0)
parser (>= 3.0.1.1)
rubocop-performance (1.11.5)
rubocop (>= 1.7.0, < 2.0)
rubocop-ast (>= 0.4.0)
ruby-progressbar (1.11.0)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.36.1)
parser (>= 3.3.1.0)
rubocop-performance (1.21.1)
rubocop (>= 1.48.1, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
ruby-progressbar (1.13.0)
safe_yaml (1.0.5)
standard (1.4.0)
rubocop (= 1.22.3)
rubocop-performance (= 1.11.5)
standard (1.37.0)
language_server-protocol (~> 3.17.0.2)
lint_roller (~> 1.0)
rubocop (~> 1.64.0)
standard-custom (~> 1.0.0)
standard-performance (~> 1.4)
standard-custom (1.0.2)
lint_roller (~> 1.0)
rubocop (~> 1.50)
standard-performance (1.4.0)
lint_roller (~> 1.1)
rubocop-performance (~> 1.21.0)
tzinfo (2.0.4)
concurrent-ruby (~> 1.0)
unicode-display_width (2.1.0)
unicode-display_width (2.6.0)
zeitwerk (2.4.2)

PLATFORMS
Expand All @@ -70,12 +86,12 @@ PLATFORMS
DEPENDENCIES
activesupport
mry (~> 0.52.0)
parser (~> 3.0.2)
parser (~> 3.3.0)
pry
rake
rspec
safe_yaml
standard (~> 1.4)
standard (= 1.37.0)

BUNDLED WITH
2.1.4
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@ You can find some basic setup instructions and links to the Standard OSS project
### Installation

1. If you haven't already, [install the Code Climate CLI](https://github.com/codeclimate/codeclimate).
2. Add the engine and enable it in your `.codeclimate.yml` file.
2. Enable the engine by adding the following under `plugins` in your `.codeclimate.yaml`:
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

adjusting README to mimic the rubocop engine instructions (which this repo was apparently made from since it has some of the original commits in it). Modified slightly to use standard as the engine name below not rubocop seen here

This also sets it up nicely for when the next standard channel (> 1.37.0) is released which will require a minimum ruby version of >= 3. I suspect given the default implementation is to either not set the channel explicitly in the .codeclimate.yml file or set it to "latest", we may (at that time in the future) see some regression when we move to that next version.

The reason I think having this setup in the README helps is we can add a channel: line to it with some comments about which explicit channel to use if you are running ruby < 3 since "latest" will be at that point running the standard version that requires it

```yaml
plugins:
standard:
enabled: true
```
3. You're ready to analyze! Browse into your project's folder and run `codeclimate analyze`.

### Need help?
Expand Down
1 change: 1 addition & 0 deletions config/contents/bundler/duplicated_gem.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
A Gem's requirements should be listed only once in a Gemfile.

### Example:
# bad
gem 'rubocop'
Expand Down
51 changes: 51 additions & 0 deletions config/contents/bundler/duplicated_group.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
A Gem group, or a set of groups, should be listed only once in a Gemfile.

For example, if the values of `source`, `git`, `platforms`, or `path`
surrounding `group` are different, no offense will be registered:

[source,ruby]
-----
platforms :ruby do
group :default do
gem 'openssl'
end
end

platforms :jruby do
group :default do
gem 'jruby-openssl'
end
end
-----

### Example:
# bad
group :development do
gem 'rubocop'
end

group :development do
gem 'rubocop-rails'
end

# bad (same set of groups declared twice)
group :development, :test do
gem 'rubocop'
end

group :test, :development do
gem 'rspec'
end

# good
group :development do
gem 'rubocop'
end

group :development, :test do
gem 'rspec'
end

# good
gem 'rubocop', groups: [:development, :test]
gem 'rspec', groups: [:development, :test]
22 changes: 22 additions & 0 deletions config/contents/bundler/gem_filename.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Verifies that a project contains Gemfile or gems.rb file and correct
associated lock file based on the configuration.

### Example: EnforcedStyle: Gemfile (default)
# bad
Project contains gems.rb and gems.locked files

# bad
Project contains Gemfile and gems.locked file

# good
Project contains Gemfile and Gemfile.lock

### Example: EnforcedStyle: gems.rb
# bad
Project contains Gemfile and Gemfile.lock files

# bad
Project contains gems.rb and Gemfile.lock file

# good
Project contains gems.rb and gems.locked files
34 changes: 23 additions & 11 deletions config/contents/bundler/insecure_protocol_source.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
The symbol argument `:gemcutter`, `:rubygems`, and `:rubyforge`
are deprecated. So please change your source to URL string that
'https://rubygems.org' if possible, or 'http://rubygems.org' if not.
Passing symbol arguments to `source` (e.g. `source :rubygems`) is
deprecated because they default to using HTTP requests. Instead, specify
`'https://rubygems.org'` if possible, or `'http://rubygems.org'` if not.

This autocorrect will replace these symbols with 'https://rubygems.org'.
Because it is secure, HTTPS request is strongly recommended. And in
most use cases HTTPS will be fine.
When autocorrecting, this cop will replace symbol arguments with
`'https://rubygems.org'`.

However, it don't replace all `sources` of `http://` with `https://`.
For example, when specifying an internal gem server using HTTP on the
intranet, a use case where HTTPS cannot be specified was considered.
Consider using HTTP only if you cannot use HTTPS.
This cop will not replace existing sources that use `http://`. This may
be necessary where HTTPS is not available. For example, where using an
internal gem server via an intranet, or where HTTPS is prohibited.
However, you should strongly prefer `https://` where possible, as it is
more secure.

If you don't allow `http://`, please set `false` to `AllowHttpProtocol`.
This option is `true` by default for safe autocorrection.

### Example:
# bad
Expand All @@ -19,4 +22,13 @@ Consider using HTTP only if you cannot use HTTPS.

# good
source 'https://rubygems.org' # strongly recommended
source 'http://rubygems.org'

### Example: AllowHttpProtocol: true (default)

# good
source 'http://rubygems.org' # use only if HTTPS is unavailable

### Example: AllowHttpProtocol: false

# bad
source 'http://rubygems.org'
10 changes: 9 additions & 1 deletion config/contents/bundler/ordered_gems.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,15 @@ Gems should be alphabetically sorted within groups.

gem 'rspec'

# good only if TreatCommentsAsGroupSeparators is true
### Example: TreatCommentsAsGroupSeparators: true (default)
# good
# For code quality
gem 'rubocop'
# For tests
gem 'rspec'

### Example: TreatCommentsAsGroupSeparators: false
# bad
# For code quality
gem 'rubocop'
# For tests
Expand Down
15 changes: 0 additions & 15 deletions config/contents/gemspec/date_assignment.md

This file was deleted.

46 changes: 46 additions & 0 deletions config/contents/gemspec/dependency_version.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
Enforce that gem dependency version specifications or a commit reference (branch,
ref, or tag) are either required or forbidden.

### Example: EnforcedStyle: required (default)

# bad
Gem::Specification.new do |spec|
spec.add_dependency 'parser'
end

# bad
Gem::Specification.new do |spec|
spec.add_development_dependency 'parser'
end

# good
Gem::Specification.new do |spec|
spec.add_dependency 'parser', '>= 2.3.3.1', '< 3.0'
end

# good
Gem::Specification.new do |spec|
spec.add_development_dependency 'parser', '>= 2.3.3.1', '< 3.0'
end

### Example: EnforcedStyle: forbidden

# bad
Gem::Specification.new do |spec|
spec.add_dependency 'parser', '>= 2.3.3.1', '< 3.0'
end

# bad
Gem::Specification.new do |spec|
spec.add_development_dependency 'parser', '>= 2.3.3.1', '< 3.0'
end

# good
Gem::Specification.new do |spec|
spec.add_dependency 'parser'
end

# good
Gem::Specification.new do |spec|
spec.add_development_dependency 'parser'
end
21 changes: 21 additions & 0 deletions config/contents/gemspec/deprecated_attribute_assignment.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Checks that deprecated attributes are not set in a gemspec file.
Removing deprecated attributes allows the user to receive smaller packed gems.

### Example:

# bad
Gem::Specification.new do |spec|
spec.name = 'your_cool_gem_name'
spec.test_files = Dir.glob('test/**/*')
end

# bad
Gem::Specification.new do |spec|
spec.name = 'your_cool_gem_name'
spec.test_files += Dir.glob('test/**/*')
end

# good
Gem::Specification.new do |spec|
spec.name = 'your_cool_gem_name'
end
Loading