mozilla/ssh_scan

View on GitHub
.github/actions/setup-ruby-1.71.0/index.js

Summary

Maintainability
B
5 hrs
Test Coverage

Function setupRuby has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export async function setupRuby(options = {}) {
  const inputs = { ...options }
  for (const key in inputDefaults) {
    if (!Object.prototype.hasOwnProperty.call(inputs, key)) {
      inputs[key] = core.getInput(key) || inputDefaults[key]
Severity: Minor
Found in .github/actions/setup-ruby-1.71.0/index.js - About 1 hr to fix

    Function parseRubyEngineAndVersion has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

    function parseRubyEngineAndVersion(rubyVersion) {
      if (rubyVersion === 'default') {
        if (fs.existsSync('.ruby-version')) {
          rubyVersion = '.ruby-version'
        } else if (fs.existsSync('.tool-versions')) {
    Severity: Minor
    Found in .github/actions/setup-ruby-1.71.0/index.js - About 1 hr to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function setupRuby has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

    export async function setupRuby(options = {}) {
      const inputs = { ...options }
      for (const key in inputDefaults) {
        if (!Object.prototype.hasOwnProperty.call(inputs, key)) {
          inputs[key] = core.getInput(key) || inputDefaults[key]
    Severity: Minor
    Found in .github/actions/setup-ruby-1.71.0/index.js - About 1 hr to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function parseRubyEngineAndVersion has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function parseRubyEngineAndVersion(rubyVersion) {
      if (rubyVersion === 'default') {
        if (fs.existsSync('.ruby-version')) {
          rubyVersion = '.ruby-version'
        } else if (fs.existsSync('.tool-versions')) {
    Severity: Minor
    Found in .github/actions/setup-ruby-1.71.0/index.js - About 1 hr to fix

      Function validateRubyEngineAndVersion has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

      function validateRubyEngineAndVersion(platform, engineVersions, engine, parsedVersion) {
        if (!engineVersions) {
          throw new Error(`Unknown engine ${engine} on ${platform}`)
        }
      
      
      Severity: Minor
      Found in .github/actions/setup-ruby-1.71.0/index.js - About 45 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      There are no issues that match your filters.

      Category
      Status