mozilla/ssh_scan

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

Summary

Maintainability
C
1 day
Test Coverage

Function bundleInstall has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

export async function bundleInstall(gemfile, lockFile, platform, engine, rubyVersion, bundlerVersion, cacheVersion) {
  if (gemfile === null) {
    console.log('Could not determine gemfile path, skipping "bundle install" and caching')
    return false
  }
Severity: Minor
Found in .github/actions/setup-ruby-1.71.0/bundler.js - About 2 hrs 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 bundleInstall has 55 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export async function bundleInstall(gemfile, lockFile, platform, engine, rubyVersion, bundlerVersion, cacheVersion) {
  if (gemfile === null) {
    console.log('Could not determine gemfile path, skipping "bundle install" and caching')
    return false
  }
Severity: Major
Found in .github/actions/setup-ruby-1.71.0/bundler.js - About 2 hrs to fix

    Function installBundler has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

    export async function installBundler(bundlerVersionInput, lockFile, platform, rubyPrefix, engine, rubyVersion) {
      let bundlerVersion = bundlerVersionInput
    
      if (bundlerVersion === 'default' || bundlerVersion === 'Gemfile.lock') {
        bundlerVersion = readBundledWithFromGemfileLock(lockFile)
    Severity: Minor
    Found in .github/actions/setup-ruby-1.71.0/bundler.js - About 2 hrs 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 installBundler has 34 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export async function installBundler(bundlerVersionInput, lockFile, platform, rubyPrefix, engine, rubyVersion) {
      let bundlerVersion = bundlerVersionInput
    
      if (bundlerVersion === 'default' || bundlerVersion === 'Gemfile.lock') {
        bundlerVersion = readBundledWithFromGemfileLock(lockFile)
    Severity: Minor
    Found in .github/actions/setup-ruby-1.71.0/bundler.js - About 1 hr to fix

      Function bundleInstall has 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      export async function bundleInstall(gemfile, lockFile, platform, engine, rubyVersion, bundlerVersion, cacheVersion) {
      Severity: Major
      Found in .github/actions/setup-ruby-1.71.0/bundler.js - About 50 mins to fix

        Function installBundler has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        export async function installBundler(bundlerVersionInput, lockFile, platform, rubyPrefix, engine, rubyVersion) {
        Severity: Minor
        Found in .github/actions/setup-ruby-1.71.0/bundler.js - About 45 mins to fix

          Function computeBaseKey has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          async function computeBaseKey(platform, engine, version, lockFile, cacheVersion) {
          Severity: Minor
          Found in .github/actions/setup-ruby-1.71.0/bundler.js - About 35 mins to fix

            Function readBundledWithFromGemfileLock has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            function readBundledWithFromGemfileLock(lockFile) {
              if (lockFile !== null && fs.existsSync(lockFile)) {
                const contents = fs.readFileSync(lockFile, 'utf8')
                const lines = contents.split(/\r?\n/)
                const bundledWithLine = lines.findIndex(line => /^BUNDLED WITH$/.test(line.trim()))
            Severity: Minor
            Found in .github/actions/setup-ruby-1.71.0/bundler.js - About 35 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