Skip to content
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

Add Standard Lint #1

Merged
merged 2 commits into from
May 6, 2024
Merged

Add Standard Lint #1

merged 2 commits into from
May 6, 2024

Conversation

TonyCTHsu
Copy link
Contributor

  1. Add Standard Lint
  2. Update gemspec and lint target version to 2.5
  3. Add Github action for linting

@TonyCTHsu TonyCTHsu requested a review from lloeki May 6, 2024 10:49
'rubygems_mfa_required' => 'true',
'source_code_uri' => 'https://github.com/lloeki/graft',
s.name = "graft"
s.version = "0.1.0"
Copy link
Member

Choose a reason for hiding this comment

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

Typically a case where I feel a rule makes the code less readable.

@@ -119,11 +119,11 @@ def wrapper(hook)
strategy: hook.point.instance_variable_get(:@strategy),
args: args,
kwargs: kwargs,
block: block,
block: block
Copy link
Member

Choose a reason for hiding this comment

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

That one is soooo annoying: every time you add an item it's making a diff on two lines.

}
supa = proc { |*args, &block| super(*args, &block) }
mid = proc { |_, env| { return: supa.call(*env[:args], &env[:block]) } }
mid = proc { |_, env| {return: supa.call(*env[:args], &env[:block])} }
Copy link
Member

Choose a reason for hiding this comment

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

Very personal, but my mind just balks at these. It's kind of strange because arrays don't cause me such a reaction.

Maybe that's because arrays are <delimiter><value>, <value><delimiter> and it parses easily, whereas hashes are <delimiter><key>: <value>, <key>, <value><delimiter> which binds the <delimiter> and the <key> in a single token.

Copy link
Member

@lloeki lloeki May 6, 2024

Choose a reason for hiding this comment

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

That said:

irb> {:a=>:b, :c=>:d}.inspect
=> "{:a=>:b, :c=>:d}"


gem 'rake', '~> 13.1.0'
gem "rake", "~> 13.1.0"
Copy link
Member

Choose a reason for hiding this comment

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

I'm annoyed by this one, because it misses something very real happening:

# frozen_string_literal: true

a = "foo"
a.frozen? # => true

b = "bar #{a}"
b.frozen? # => false

IOW the rule that makes it so ' is used only when there's interpolation indirectly translates to imply ' is a frozen string and " is not.

Also, " requires a shift while ' does not.

Copy link
Member

@lloeki lloeki left a comment

Choose a reason for hiding this comment

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

Let's not quibble and move forward.

@lloeki lloeki merged commit e5834df into main May 6, 2024
3 checks passed
@lloeki lloeki deleted the tonycthsu/add-lint-action branch May 6, 2024 13:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants