Stromweld/autopatch_ii

View on GitHub

Showing 77 of 77 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']['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.

    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

      Ensure maintainer_email is set in metadata
      Open

      name 'test'

      Ensure maintainer 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.

      Ordered list item prefix
      Open

         4. Redistribution. You may reproduce and distribute copies of the
      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

      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

      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

      Avoid rescuing without specifying an error class.
      Open

          rescue
      Severity: Minor
      Found in recipes/linux.rb by rubocop

      This cop checks for rescuing StandardError. There are two supported styles implicit and explicit. This cop will not register an offense if any error other than StandardError is specified.

      Example: EnforcedStyle: implicit

      # `implicit` will enforce using `rescue` instead of
      # `rescue StandardError`.
      
      # bad
      begin
        foo
      rescue StandardError
        bar
      end
      
      # good
      begin
        foo
      rescue
        bar
      end
      
      # good
      begin
        foo
      rescue OtherError
        bar
      end
      
      # good
      begin
        foo
      rescue StandardError, SecurityError
        bar
      end

      Example: EnforcedStyle: explicit (default)

      # `explicit` will enforce using `rescue StandardError`
      # instead of `rescue`.
      
      # bad
      begin
        foo
      rescue
        bar
      end
      
      # good
      begin
        foo
      rescue StandardError
        bar
      end
      
      # good
      begin
        foo
      rescue OtherError
        bar
      end
      
      # good
      begin
        foo
      rescue StandardError, SecurityError
        bar
      end

      Trailing punctuation in header
      Open

      ### What do I do next?

      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.

      Missing magic comment # frozen_string_literal: true.
      Open

      #
      Severity: Minor
      Found in recipes/firstrun_patches.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

      Use snake_case for variable names.
      Open

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

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

      Example: EnforcedStyle: snake_case (default)

      # bad
      fooBar = 1
      
      # good
      foo_bar = 1

      Example: EnforcedStyle: camelCase

      # bad
      foo_bar = 1
      
      # good
      fooBar = 1

      Missing magic comment # frozen_string_literal: true.
      Open

      #
      Severity: Minor
      Found in libraries/autopatch_helpers.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

      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

      #
      Severity: Minor
      Found in recipes/default.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

      Prefer Date or Time over DateTime.
      Open

                    Chef::Log::debug("Re-enabling autopatch_ii for month #{DateTime.now.strftime('%^b')}")
      Severity: Minor
      Found in recipes/linux.rb by rubocop

      This cop checks for uses of DateTime that should be replaced by Date or Time.

      Example:

      # bad - uses `DateTime` for current time
      DateTime.now
      
      # good - uses `Time` for current time
      Time.now
      
      # bad - uses `DateTime` for modern date
      DateTime.iso8601('2016-06-29')
      
      # good - uses `Date` for modern date
      Date.iso8601('2016-06-29')
      
      # good - uses `DateTime` with start argument for historical date
      DateTime.iso8601('1751-04-23', Date::ENGLAND)

      Missing magic comment # frozen_string_literal: true.
      Open

      source 'https://supermarket.chef.io'
      Severity: Minor
      Found in Berksfile 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