ElMassimo/vite_ruby

View on GitHub

Showing 11 of 23 total issues

Class Manifest has 23 methods (exceeds 20 allowed). Consider refactoring.
Open

class ViteRuby::Manifest
  def initialize(vite_ruby)
    @vite_ruby = vite_ruby
    @build_mutex = Mutex.new if config.auto_build
  end
Severity: Minor
Found in vite_ruby/lib/vite_ruby/manifest.rb - About 2 hrs to fix

    Class Config has 22 methods (exceeds 20 allowed). Consider refactoring.
    Open

    class ViteRuby::Config
      def origin
        "#{ protocol }://#{ host_with_port }"
      end
    
    
    Severity: Minor
    Found in vite_ruby/lib/vite_ruby/config.rb - About 2 hrs to fix

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

      export function assetsManifestPlugin (): Plugin {
        let config: ResolvedConfig
        let viteRubyConfig: UnifiedConfig
      
        // Internal: Vite ignores some entrypoint assets, so we need to manually
      Severity: Minor
      Found in vite-plugin-ruby/src/manifest.ts - About 1 hr to fix

        Function config has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function config (userConfig: UserConfig, env: ConfigEnv): UserConfig {
          const config = loadConfiguration(env.mode, projectRoot, userConfig)
          const { assetsDir, base, outDir, server, root, entrypoints, ssrBuild } = config
        
          const isLocal = config.mode === 'development' || config.mode === 'test'
        Severity: Minor
        Found in vite-plugin-ruby/src/index.ts - About 1 hr to fix

          Method run has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

            def run(argv, exec: false)
              config.within_root {
                cmd = command_for(argv)
                return Kernel.exec(*cmd) if exec
          
          
          Severity: Minor
          Found in vite_ruby/lib/vite_ruby/runner.rb - 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

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

          function coerceConfigurationValues (config: ResolvedConfig, projectRoot: string, userConfig: UserConfig): UnifiedConfig {
            // Coerce the values to the expected types.
            const port = config.port = parseInt(config.port as unknown as string)
            const https = config.https = userConfig.server?.https || booleanOption(config.https)
          
          
          Severity: Minor
          Found in vite-plugin-ruby/src/config.ts - 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

          Method command_for has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

            def command_for(args)
              [config.to_env(env)].tap do |cmd|
                args = args.clone
                cmd.push('node', '--inspect-brk') if args.delete('--inspect')
                cmd.push('node', '--trace-deprecation') if args.delete('--trace_deprecation')
          Severity: Minor
          Found in vite_ruby/lib/vite_ruby/runner.rb - 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

          Method log_build_result has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

            def log_build_result(_stdout, stderr, status)
              if status.success?
                logger.info "Build with Vite complete: #{ config.build_output_dir }"
                logger.error stderr unless stderr.empty?
              else
          Severity: Minor
          Found in vite_ruby/lib/vite_ruby/builder.rb - 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

          Method print_info has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

            def print_info
              config.within_root do
                $stdout.puts "bin/vite present?: #{ File.exist? 'bin/vite' }"
          
                $stdout.puts "vite_ruby: #{ ViteRuby::VERSION }"
          Severity: Minor
          Found in vite_ruby/lib/vite_ruby/commands.rb - 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

          Function assetsManifestPlugin has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

          export function assetsManifestPlugin (): Plugin {
            let config: ResolvedConfig
            let viteRubyConfig: UnifiedConfig
          
            // Internal: Vite ignores some entrypoint assets, so we need to manually
          Severity: Minor
          Found in vite-plugin-ruby/src/manifest.ts - About 25 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

          Method parse_metadata has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              def parse_metadata(pathname)
                return default_metadata unless pathname.exist?
          
                JSON.parse(pathname.read.to_s).transform_keys(&:to_sym).slice(*members)
              rescue JSON::JSONError, Errno::ENOENT, Errno::ENOTDIR
          Severity: Minor
          Found in vite_ruby/lib/vite_ruby/build.rb - About 25 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

          Severity
          Category
          Status
          Source
          Language