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
Class Config
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
class ViteRuby::Config
def origin
"#{ protocol }://#{ host_with_port }"
end
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
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'
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')
- Read upRead up
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 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
- Read upRead up
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)
- Read upRead up
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 }"
- Read upRead up
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
- Read upRead up
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
- Read upRead up
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
- Read upRead up
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"