Fix rubocop ``Naming/MethodName`` violations
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 35/100
Direzione di ricerca
Inizia con lib/puppet-strings/yard/handlers/ruby/data_type_handler.rb e lib/puppet-strings/yard/parsers/puppet/parser.rb, esaminando i metodi segnalati da Naming/MethodName e il loro impatto a valle. Esegui bundle exec rubocop --format github dopo aver rimosso i marcatori di disabilitazione. Il lavoro è completo quando le violazioni segnalate sono risolte e RuboCop termina senza eccezioni.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Describe the Bug
Rubocop recently began failing because of Naming/MethodName violations in 2 files:
lib/puppet-strings/yard/handlers/ruby/data_type_handler.rblib/puppet-strings/yard/parsers/puppet/parser.rb
Since
- running
rubocop --auto-gen-configdoes not (at this time) add these violations to the.rubocop_todo.yml; and - adjusting these methods may have a downstream impact; and
- CI needs to be made green but not without recording a TODO to fix the violations
Then it was decided to explicitly
- add a #TODO to the files and a
rubocop:disable Naming/MethodName; and - raise this issue to record the requirement.
See PR https://github.com/puppetlabs/puppet-strings/pull/364
Expected Behavior
Rubocop should not throw any exceptions
Steps to Reproduce
Steps to reproduce the behavior:
- Remove the
rubocop:disable Naming/MethodNameandrubocop:enable Naming/MethodNamemarkers from the above files - Re-run on the terminal
bundle exec rubocop --format githuband note the exceptions as listed at the end of this issue.
Environment
- Version [e.g. 1.27.0]
- Platform [e.g. Ubuntu 18.04]
Additional Context
See below the output from rubocop and the diff showing the rubocop disable commands:
➜ puppet-strings git:(cat-1404-fix_rubocop_nightly_failures) ✗ bundle exec rubocop --format github
::error file=lib/puppet-strings/yard/handlers/ruby/data_type_handler.rb,line=147,col=9::Naming/MethodName: Use snake_case for method names.
::error file=lib/puppet-strings/yard/handlers/ruby/data_type_handler.rb,line=151,col=9::Naming/MethodName: Use snake_case for method names.
::error file=lib/puppet-strings/yard/handlers/ruby/data_type_handler.rb,line=156,col=9::Naming/MethodName: Use snake_case for method names.
::error file=lib/puppet-strings/yard/handlers/ruby/data_type_handler.rb,line=162,col=9::Naming/MethodName: Use snake_case for method names.
::error file=lib/puppet-strings/yard/handlers/ruby/data_type_handler.rb,line=166,col=9::Naming/MethodName: Use snake_case for method names.
::error file=lib/puppet-strings/yard/handlers/ruby/data_type_handler.rb,line=170,col=9::Naming/MethodName: Use snake_case for method names.
::error file=lib/puppet-strings/yard/handlers/ruby/data_type_handler.rb,line=174,col=9::Naming/MethodName: Use snake_case for method names.
::error file=lib/puppet-strings/yard/handlers/ruby/data_type_handler.rb,line=178,col=9::Naming/MethodName: Use snake_case for method names.
::error file=lib/puppet-strings/yard/handlers/ruby/data_type_handler.rb,line=182,col=9::Naming/MethodName: Use snake_case for method names.
::error file=lib/puppet-strings/yard/handlers/ruby/data_type_handler.rb,line=186,col=9::Naming/MethodName: Use snake_case for method names.
::error file=lib/puppet-strings/yard/handlers/ruby/data_type_handler.rb,line=190,col=9::Naming/MethodName: Use snake_case for method names.
::error file=lib/puppet-strings/yard/handlers/ruby/data_type_handler.rb,line=194,col=9::Naming/MethodName: Use snake_case for method names.
::error file=lib/puppet-strings/yard/handlers/ruby/data_type_handler.rb,line=198,col=9::Naming/MethodName: Use snake_case for method names.
::error file=lib/puppet-strings/yard/handlers/ruby/data_type_handler.rb,line=202,col=9::Naming/MethodName: Use snake_case for method names.
::error file=lib/puppet-strings/yard/handlers/ruby/data_type_handler.rb,line=208,col=9::Naming/MethodName: Use snake_case for method names.
::error file=lib/puppet-strings/yard/handlers/ruby/data_type_handler.rb,line=212,col=9::Naming/MethodName: Use snake_case for method names.
::error file=lib/puppet-strings/yard/parsers/puppet/parser.rb,line=43,col=7::Naming/MethodName: Use snake_case for method names.
::error file=lib/puppet-strings/yard/parsers/puppet/parser.rb,line=49,col=7::Naming/MethodName: Use snake_case for method names.
::error file=lib/puppet-strings/yard/parsers/puppet/parser.rb,line=53,col=7::Naming/MethodName: Use snake_case for method names.
::error file=lib/puppet-strings/yard/parsers/puppet/parser.rb,line=59,col=7::Naming/MethodName: Use snake_case for method names.
::error file=lib/puppet-strings/yard/parsers/puppet/parser.rb,line=65,col=7::Naming/MethodName: Use snake_case for method names.
::error file=lib/puppet-strings/yard/parsers/puppet/parser.rb,line=71,col=7::Naming/MethodName: Use snake_case for method names.
::error file=lib/puppet-strings/yard/parsers/puppet/parser.rb,line=77,col=7::Naming/MethodName: Use snake_case for method names.
::error file=lib/puppet-strings/yard/parsers/puppet/parser.rb,line=83,col=7::Naming/MethodName: Use snake_case for method names.
➜ puppet-strings git:(cat-1404-fix_rubocop_nightly_failures) ✗ code lib/puppet-strings/yard/handlers/ruby/data_type_handler.rb
➜ puppet-strings git:(cat-1404-fix_rubocop_nightly_failures) ✗ git diff
diff --git a/lib/puppet-strings/yard/handlers/ruby/data_type_handler.rb b/lib/puppet-strings/yard/handlers/ruby/data_type_handler.rb
index 7268d46..20c8569 100644
--- a/lib/puppet-strings/yard/handlers/ruby/data_type_handler.rb
+++ b/lib/puppet-strings/yard/handlers/ruby/data_type_handler.rb
@@ -143,6 +143,8 @@ class PuppetStrings::Yard::Handlers::Ruby::DataTypeHandler < PuppetStrings::Yard
@literal_visitor.visit_this_0(self, ast)
end
+ # TODO: Fix the rubocop violations in this file between the following rubocop:disable/enable lines
+ # rubocop:disable Naming/MethodName
# ----- The following methods are different/additions from the original Literal_evaluator
def literal_Object(o)
# Ignore any other object types
@@ -214,6 +216,7 @@ class PuppetStrings::Yard::Handlers::Ruby::DataTypeHandler < PuppetStrings::Yard
result[literal(entry.key)] = literal(entry.value)
end
end
+ # rubocop:enable Naming/MethodName
end
# Extracts the datatype attributes from a Puppet Data Type interface hash.
diff --git a/lib/puppet-strings/yard/parsers/puppet/parser.rb b/lib/puppet-strings/yard/parsers/puppet/parser.rb
index 98f4e30..7d227bf 100644
--- a/lib/puppet-strings/yard/parsers/puppet/parser.rb
+++ b/lib/puppet-strings/yard/parsers/puppet/parser.rb
@@ -40,6 +40,8 @@ class PuppetStrings::Yard::Parsers::Puppet::Parser < YARD::Parser::Base
private
+ # TODO: Fix the rubocop violations in this file between the following rubocop:disable/enable lines
+ # rubocop:disable Naming/MethodName
def transform_Program(o)
# Cache the lines of the source text; we'll use this to locate comments
@lines = o.source_text.lines.to_a
@@ -83,4 +85,5 @@ class PuppetStrings::Yard::Parsers::Puppet::Parser < YARD::Parser::Base
def transform_Object(o)
# Ignore anything else (will be compacted out of the resulting array)
end
+ # rubocop:enable Naming/MethodName
end
➜ puppet-strings git:(cat-1404-fix_rubocop_nightly_failures) ✗
- Lingua principale
- Ruby
- Stelle
- 90
- Fork
- 92
- Merge medio
- 13h 23m
- PR unite (30g)
- 2
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di puppetlabs/puppet-strings
-
bug
Difficoltà 4/5 3-5 giorni Idoneità per principianti 25/100
puppetlabs/puppet-strings#389 · 3 commenti · 1 reazione ·
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 55/100
puppetlabs/puppet-strings#386 ·
-
maintenance
Difficoltà 2/5 1-3 ore Idoneità per principianti 35/100
puppetlabs/puppet-strings#370 ·
-
community feature
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
puppetlabs/puppet-strings#353 ·
-
bug
Difficoltà 3/5 1-2 giorni Idoneità per principianti 35/100
puppetlabs/puppet-strings#298 ·
Tutte le issue di puppetlabs/puppet-strings
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 77/100
I maintainer di solito rispondono entro 1 giorno
-
L: javascript
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
dependabot/dependabot-core#16744 ·
I maintainer di solito rispondono entro 1 giorno
-
area:core-lib P2 size:S
Difficoltà 2/5 1-3 ore Idoneità per principianti 77/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
I maintainer di solito rispondono entro 1 giorno