Stromweld/autopatch_ii

View on GitHub

Showing 83 of 83 total issues

Assignment Branch Condition size for next_monthly_date is too high. [17.38/15]
Open

      def self.next_monthly_date(monthly_specifier, hour, minute)
        current_time = Time.now
        current_patch_time = Time.new(
          current_time.year,
          current_time.month,
Severity: Minor
Found in libraries/autopatch.rb by rubocop

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

Avoid deeply nested control flow statements.
Open

          if node['autopatch_ii']['disable'] == false
            node.override['autopatch_ii']['disable'] = true
            node.override['autopatch_ii']['private_lin_autopatch_disabled_programmatically'] = true
            Chef::Log::debug("Disabling autopatch_ii for month #{DateTime.now.strftime('%^b')}!!")
          end
Severity: Major
Found in recipes/linux.rb - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

              if node['autopatch_ii']['private_lin_autopatch_disabled_programmatically'] == true
                if node['autopatch_ii']['disable'] == true
                  # Re-enable it
                  Chef::Log::debug("Re-enabling autopatch_ii for month #{DateTime.now.strftime('%^b')}")
                  node.override['autopatch_ii']['disable'] = false
    Severity: Major
    Found in recipes/linux.rb - About 45 mins to fix

      Block has too many lines. [30/25]
      Open

        powershell_script 'win-update' do
          code <<-EOH
          Function WSUSUpdate {
            $Criteria = "IsInstalled=0 and Type='Software'"
            $Searcher = New-Object -ComObject Microsoft.Update.Searcher
      Severity: Minor
      Found in recipes/firstrun_patches.rb by rubocop

      This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.

      Ensure maintainer is set in metadata
      Open

      name 'test'

      Ensure maintainer_email is set in metadata
      Open

      name 'test'

      Prefer conditional attributes
      Open

      unless os.windows?

      This warning means you have surrounded a resource with an if or unless rather than defining the condition directly on the resource itself. Note that this warning is only raised for single resources as you could reasonably enclose multiple resources in a condition like this for brevity.

      Jay Feldblum has expressed criticism of this rule because the effect is that resources are defined unnecessarily and ignored only at run-time. His view is that it is cleaner to use standard Ruby conditionals to avoid defining them in the first place.

      Missing magic comment # frozen_string_literal: true.
      Open

      #

      This cop is designed to help upgrade to Ruby 3.0. It will add the comment # frozen_string_literal: true to the top of files to enable frozen string literals. Frozen string literals may be default in Ruby 3.0. The comment will be added below a shebang and encoding comment. The frozen string literal comment is only valid in Ruby 2.3+.

      Example: EnforcedStyle: when_needed (default)

      # The `when_needed` style will add the frozen string literal comment
      # to files only when the `TargetRubyVersion` is set to 2.3+.
      # bad
      module Foo
        # ...
      end
      
      # good
      # frozen_string_literal: true
      
      module Foo
        # ...
      end

      Example: EnforcedStyle: always

      # The `always` style will always add the frozen string literal comment
      # to a file, regardless of the Ruby version or if `freeze` or `<

      Example: EnforcedStyle: never

      # The `never` will enforce that the frozen string literal comment does
      # not exist in a file.
      # bad
      # frozen_string_literal: true
      
      module Baz
        # ...
      end
      
      # good
      module Baz
        # ...
      end

      Missing magic comment # frozen_string_literal: true.
      Open

      %w(unit lint syntax).each do |phase|

      This cop is designed to help upgrade to Ruby 3.0. It will add the comment # frozen_string_literal: true to the top of files to enable frozen string literals. Frozen string literals may be default in Ruby 3.0. The comment will be added below a shebang and encoding comment. The frozen string literal comment is only valid in Ruby 2.3+.

      Example: EnforcedStyle: when_needed (default)

      # The `when_needed` style will add the frozen string literal comment
      # to files only when the `TargetRubyVersion` is set to 2.3+.
      # bad
      module Foo
        # ...
      end
      
      # good
      # frozen_string_literal: true
      
      module Foo
        # ...
      end

      Example: EnforcedStyle: always

      # The `always` style will always add the frozen string literal comment
      # to a file, regardless of the Ruby version or if `freeze` or `<

      Example: EnforcedStyle: never

      # The `never` will enforce that the frozen string literal comment does
      # not exist in a file.
      # bad
      # frozen_string_literal: true
      
      module Baz
        # ...
      end
      
      # good
      module Baz
        # ...
      end

      Use snake_case for method names.
      Open

        def self.getLCaseWeekdayFromAbbreviation(abbreviatedWeekday)
      Severity: Minor
      Found in libraries/autopatch_helpers.rb by rubocop

      This cop makes sure that all methods use the configured style, snake_case or camelCase, for their names.

      Example: EnforcedStyle: snake_case (default)

      # bad
      def fooBar; end
      
      # good
      def foo_bar; end

      Example: EnforcedStyle: camelCase

      # bad
      def foo_bar; end
      
      # good
      def fooBar; end

      Extra blank line detected.
      Open

      
      require 'spec_helper'
      Severity: Minor
      Found in spec/unit/recipes/default_spec.rb by rubocop

      This cops checks for two or more consecutive blank lines.

      Example:

      # bad - It has two empty lines.
      some_method
      # one empty line
      # two empty lines
      some_method
      
      # good
      some_method
      # one empty line
      some_method

      Trailing punctuation in header
      Open

      ### What if I get stuck?

      MD026 - Trailing punctuation in header

      Tags: headers

      Aliases: no-trailing-punctuation

      Parameters: punctuation (string; default ".,;:!?")

      This rule is triggered on any header that has a punctuation character as the last character in the line:

      # This is a header.

      To fix this, remove any trailing punctuation:

      # This is a header

      Note: The punctuation parameter can be used to specify what characters class as punctuation at the end of the header. For example, you can set it to '.,;:!' to allow headers with question marks in them, such as might be used in an FAQ.

      Code block style
      Open

                                       Apache License
      Severity: Info
      Found in LICENSE.md by markdownlint

      Missing magic comment # frozen_string_literal: true.
      Open

      name 'test'

      This cop is designed to help upgrade to Ruby 3.0. It will add the comment # frozen_string_literal: true to the top of files to enable frozen string literals. Frozen string literals may be default in Ruby 3.0. The comment will be added below a shebang and encoding comment. The frozen string literal comment is only valid in Ruby 2.3+.

      Example: EnforcedStyle: when_needed (default)

      # The `when_needed` style will add the frozen string literal comment
      # to files only when the `TargetRubyVersion` is set to 2.3+.
      # bad
      module Foo
        # ...
      end
      
      # good
      # frozen_string_literal: true
      
      module Foo
        # ...
      end

      Example: EnforcedStyle: always

      # The `always` style will always add the frozen string literal comment
      # to a file, regardless of the Ruby version or if `freeze` or `<

      Example: EnforcedStyle: never

      # The `never` will enforce that the frozen string literal comment does
      # not exist in a file.
      # bad
      # frozen_string_literal: true
      
      module Baz
        # ...
      end
      
      # good
      module Baz
        # ...
      end

      Do not use :: for method calls.
      Open

                  Chef::Log::debug('Reset programmatic flag node[\'autopatch_ii\'][\'private_lin_autopatch_disabled_programmatically\'] to false.')
      Severity: Minor
      Found in recipes/linux.rb by rubocop

      This cop checks for methods invoked via the :: operator instead of the . operator (like FileUtils::rmdir instead of FileUtils.rmdir).

      Example:

      # bad
      Timeout::timeout(500) { do_something }
      FileUtils::rmdir(dir)
      Marshal::dump(obj)
      
      # good
      Timeout.timeout(500) { do_something }
      FileUtils.rmdir(dir)
      Marshal.dump(obj)

      Ordered list item prefix
      Open

         9. Accepting Warranty or Additional Liability. While redistributing
      Severity: Info
      Found in LICENSE.md by markdownlint

      MD029 - Ordered list item prefix

      Tags: ol

      Aliases: ol-prefix

      Parameters: style ("one", "ordered"; default "one")

      This rule is triggered on ordered lists that do not either start with '1.' or do not have a prefix that increases in numerical order (depending on the configured style, which defaults to 'one').

      Example valid list if the style is configured as 'one':

      1. Do this.
      1. Do that.
      1. Done.

      Example valid list if the style is configured as 'ordered':

      1. Do this.
      2. Do that.
      3. Done.

      Missing magic comment # frozen_string_literal: true.
      Open

      #

      This cop is designed to help upgrade to Ruby 3.0. It will add the comment # frozen_string_literal: true to the top of files to enable frozen string literals. Frozen string literals may be default in Ruby 3.0. The comment will be added below a shebang and encoding comment. The frozen string literal comment is only valid in Ruby 2.3+.

      Example: EnforcedStyle: when_needed (default)

      # The `when_needed` style will add the frozen string literal comment
      # to files only when the `TargetRubyVersion` is set to 2.3+.
      # bad
      module Foo
        # ...
      end
      
      # good
      # frozen_string_literal: true
      
      module Foo
        # ...
      end

      Example: EnforcedStyle: always

      # The `always` style will always add the frozen string literal comment
      # to a file, regardless of the Ruby version or if `freeze` or `<

      Example: EnforcedStyle: never

      # The `never` will enforce that the frozen string literal comment does
      # not exist in a file.
      # bad
      # frozen_string_literal: true
      
      module Baz
        # ...
      end
      
      # good
      module Baz
        # ...
      end

      Ordered list item prefix
      Open

         2. Grant of Copyright License. Subject to the terms and conditions of
      Severity: Info
      Found in LICENSE.md by markdownlint

      MD029 - Ordered list item prefix

      Tags: ol

      Aliases: ol-prefix

      Parameters: style ("one", "ordered"; default "one")

      This rule is triggered on ordered lists that do not either start with '1.' or do not have a prefix that increases in numerical order (depending on the configured style, which defaults to 'one').

      Example valid list if the style is configured as 'one':

      1. Do this.
      1. Do that.
      1. Done.

      Example valid list if the style is configured as 'ordered':

      1. Do this.
      2. Do that.
      3. Done.

      Ordered list item prefix
      Open

         6. Trademarks. This License does not grant permission to use the trade
      Severity: Info
      Found in LICENSE.md by markdownlint

      MD029 - Ordered list item prefix

      Tags: ol

      Aliases: ol-prefix

      Parameters: style ("one", "ordered"; default "one")

      This rule is triggered on ordered lists that do not either start with '1.' or do not have a prefix that increases in numerical order (depending on the configured style, which defaults to 'one').

      Example valid list if the style is configured as 'one':

      1. Do this.
      1. Do that.
      1. Done.

      Example valid list if the style is configured as 'ordered':

      1. Do this.
      2. Do that.
      3. Done.

      Missing magic comment # frozen_string_literal: true.
      Open

      name 'autopatch_ii'
      Severity: Minor
      Found in metadata.rb by rubocop

      This cop is designed to help upgrade to Ruby 3.0. It will add the comment # frozen_string_literal: true to the top of files to enable frozen string literals. Frozen string literals may be default in Ruby 3.0. The comment will be added below a shebang and encoding comment. The frozen string literal comment is only valid in Ruby 2.3+.

      Example: EnforcedStyle: when_needed (default)

      # The `when_needed` style will add the frozen string literal comment
      # to files only when the `TargetRubyVersion` is set to 2.3+.
      # bad
      module Foo
        # ...
      end
      
      # good
      # frozen_string_literal: true
      
      module Foo
        # ...
      end

      Example: EnforcedStyle: always

      # The `always` style will always add the frozen string literal comment
      # to a file, regardless of the Ruby version or if `freeze` or `<

      Example: EnforcedStyle: never

      # The `never` will enforce that the frozen string literal comment does
      # not exist in a file.
      # bad
      # frozen_string_literal: true
      
      module Baz
        # ...
      end
      
      # good
      module Baz
        # ...
      end
      Severity
      Category
      Status
      Source
      Language