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

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']['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

    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

      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.

      Ensure maintainer_email is set in metadata
      Open

      name 'test'

      Ensure maintainer is set in metadata
      Open

      name 'test'

      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

      Freeze mutable objects assigned to constants.
      Open

            WEEKDAYS = %w(sunday monday tuesday wednesday thursday friday saturday) unless defined?(WEEKDAYS)
      Severity: Minor
      Found in libraries/autopatch.rb by rubocop

      This cop checks whether some constant value isn't a mutable literal (e.g. array or hash).

      Example:

      # bad
      CONST = [1, 2, 3]
      
      # good
      CONST = [1, 2, 3].freeze

      Ensure issues_url is set in metadata
      Open

      name 'build_cookbook'

      This warning is shown if a cookbook does not include the issues_url property in its metadata file. issues_url is used to point to the location for submitting issues (bugs) for the cookbook and is currently parsed by Supermarket to add links to community cookbooks. Note: issues_url is a Chef 12 only feature that will cause cookbook failures in Chef 11 so it should be properly gated if the code will be run on Chef 11 hosts.

      Trailing punctuation in header
      Open

      ### Why do I have to make a commit every time?

      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.

      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

      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 attributes/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

      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

      Missing magic comment # frozen_string_literal: true.
      Open

      name 'build_cookbook'

      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 place comments on the same line as the end keyword.
      Open

          end # end task_frequency_modifier
      Severity: Minor
      Found in recipes/linux.rb by rubocop

      This cop checks for comments put on the same line as some keywords. These keywords are: begin, class, def, end, module.

      Note that some comments (such as :nodoc: and rubocop:disable) are allowed.

      Example:

      # bad
      if condition
        statement
      end # end if
      
      # bad
      class X # comment
        statement
      end
      
      # bad
      def x; end # comment
      
      # good
      if condition
        statement
      end
      
      # good
      class X # :nodoc:
        y
      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
      Severity
      Category
      Status
      Source
      Language