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

(CAT-1404)- Fix rubocop nightly failures #364

Merged
merged 2 commits into from
Sep 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 37 additions & 32 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,11 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2023-04-13 12:45:07 UTC using RuboCop version 1.50.1.
# on 2023-09-12 16:29:51 UTC using RuboCop version 1.56.3.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.

Naming/FileName:
Exclude:
- 'lib/puppet-strings.rb'

Naming/MethodName:
Exclude:
- 'lib/puppet-strings/yard/handlers/ruby/data_type_handler.rb'
- 'lib/puppet-strings/yard/parsers/puppet/parser.rb'

# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: Severity, Include.
Expand All @@ -23,16 +14,16 @@ Gemspec/RequireMFA:
Exclude:
- 'puppet-strings.gemspec'

# Offense count: 46
# Offense count: 45
# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
Metrics/AbcSize:
Max: 98
Max: 95

# Offense count: 11
# Offense count: 10
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns, inherit_mode.
# AllowedMethods: refine
Metrics/BlockLength:
Max: 119
Max: 44

# Offense count: 1
# Configuration parameters: CountBlocks.
Expand All @@ -44,23 +35,23 @@ Metrics/BlockNesting:
Metrics/ClassLength:
Max: 283

# Offense count: 33
# Offense count: 34
# Configuration parameters: AllowedMethods, AllowedPatterns.
Metrics/CyclomaticComplexity:
Max: 36

# Offense count: 44
# Offense count: 42
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
Metrics/MethodLength:
Max: 75

# Offense count: 2
# Offense count: 3
# Configuration parameters: CountKeywordArgs.
Metrics/ParameterLists:
MaxOptionalParameters: 5
Max: 10

# Offense count: 28
# Offense count: 29
# Configuration parameters: AllowedMethods, AllowedPatterns.
Metrics/PerceivedComplexity:
Max: 37
Expand All @@ -71,13 +62,27 @@ Naming/AccessorMethodName:
- 'lib/puppet-strings/yard/handlers/puppet/base.rb'
- 'lib/puppet-strings/yard/handlers/ruby/type_base.rb'

# Offense count: 1
# Configuration parameters: ExpectMatchingDefinition, CheckDefinitionPathHierarchy, CheckDefinitionPathHierarchyRoots, Regex, IgnoreExecutableScripts, AllowedAcronyms.
# CheckDefinitionPathHierarchyRoots: lib, spec, test, src
# AllowedAcronyms: CLI, DSL, ACL, API, ASCII, CPU, CSS, DNS, EOF, GUID, HTML, HTTP, HTTPS, ID, IP, JSON, LHS, QPS, RAM, RHS, RPC, SLA, SMTP, SQL, SSH, TCP, TLS, TTL, UDP, UI, UID, UUID, URI, URL, UTF8, VM, XML, XMPP, XSRF, XSS
Naming/FileName:
Exclude:
- 'lib/puppet-strings.rb'

# Offense count: 1
# Configuration parameters: ForbiddenDelimiters.
# ForbiddenDelimiters: (?i-mx:(^|\s)(EO[A-Z]{1}|END)(\s|$))
Naming/HeredocDelimiterNaming:
Exclude:
- 'spec/acceptance/generate_markdown_spec.rb'

# Offense count: 24
# Configuration parameters: AllowedPatterns.
# SupportedStyles: snake_case, camelCase
Naming/MethodName:
EnforcedStyle: snake_case

# Offense count: 24
# Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
# AllowedNames: as, at, by, cc, db, id, if, in, io, ip, of, on, os, pp, to
Expand All @@ -96,9 +101,9 @@ Performance/CollectionLiteralInLoop:
# Offense count: 1
RSpec/BeforeAfterAll:
Exclude:
- 'spec/spec_helper.rb'
- 'spec/rails_helper.rb'
- 'spec/support/**/*.rb'
- '**/spec/spec_helper.rb'
- '**/spec/rails_helper.rb'
- '**/spec/support/**/*.rb'
- 'spec/acceptance/running_strings_generate_spec.rb'

# Offense count: 7
Expand All @@ -124,7 +129,7 @@ RSpec/DescribeClass:
- 'spec/acceptance/generate_markdown_spec.rb'
- 'spec/acceptance/running_strings_generate_spec.rb'

# Offense count: 48
# Offense count: 51
# Configuration parameters: CountAsOne.
RSpec/ExampleLength:
Max: 66
Expand All @@ -134,12 +139,6 @@ RSpec/ExpectInHook:
Exclude:
- 'spec/unit/puppet-strings/json_spec.rb'

# Offense count: 20
# Configuration parameters: Include, CustomTransform, IgnoreMethods, SpecSuffixOnly.
# Include: **/*_spec*rb*, **/spec/**/*
RSpec/FilePath:
Enabled: false

# Offense count: 91
RSpec/MultipleExpectations:
Max: 64
Expand All @@ -154,24 +153,30 @@ RSpec/RepeatedExampleGroupDescription:
Exclude:
- 'spec/unit/puppet-strings/yard/handlers/ruby/function_handler_spec.rb'

# Offense count: 20
# Configuration parameters: Include, CustomTransform, IgnoreMethods, IgnoreMetadata.
# Include: **/*_spec.rb
RSpec/SpecFilePathFormat:
Enabled: false

# Offense count: 1
Style/ClassVars:
Exclude:
- 'lib/puppet-strings/yard/templates/default/layout/html/setup.rb'

# Offense count: 3
# This cop supports unsafe autocorrection (--autocorrect-all).
Style/CombinableLoops:
Exclude:
- 'lib/puppet-strings/markdown.rb'
- 'lib/puppet-strings/yard/handlers/ruby/data_type_handler.rb'
- 'lib/puppet-strings/tasks/generate.rb'

# Offense count: 1
Style/MixinUsage:
Exclude:
- 'spec/acceptance/running_strings_generate_spec.rb'

# Offense count: 17
# Offense count: 20
# Configuration parameters: AllowedMethods.
# AllowedMethods: respond_to_missing?
Style/OptionalBooleanParameter:
Expand All @@ -190,9 +195,9 @@ Style/OptionalBooleanParameter:
- 'lib/puppet-strings/yard/handlers/ruby/data_type_handler.rb'
- 'lib/puppet-strings/yard/handlers/ruby/function_handler.rb'

# Offense count: 139
# Offense count: 136
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns.
# URISchemes: http, https
Layout/LineLength:
Max: 200
Max: 199
3 changes: 3 additions & 0 deletions lib/puppet-strings/yard/handlers/ruby/data_type_handler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,8 @@ def literal(ast)
@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
Expand Down Expand Up @@ -214,6 +216,7 @@ def literal_LiteralHash(o)
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.
Expand Down
3 changes: 3 additions & 0 deletions lib/puppet-strings/yard/parsers/puppet/parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ def enumerator

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
Expand Down Expand Up @@ -83,4 +85,5 @@ def transform_TypeAlias(o)
def transform_Object(o)
# Ignore anything else (will be compacted out of the resulting array)
end
# rubocop:enable Naming/MethodName
end