File scaffold.rb
has 631 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'fileutils'
require 'os'
require 'facets/string/titlecase'
# TODO refactor to nest under RakeTask namespace
Method custom_window_file
has 131 lines of code (exceeds 25 allowed). Consider refactoring. Open
def custom_window_file(custom_window_name, namespace, window_type, window_options = {})
window_options ||= {}
window_options[:custom_window_class_name] ||= 'CustomWindow'
namespace_type = class_name(namespace) == class_name(current_dir_name) ? 'class' : 'module'
Method custom_window_file
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def custom_window_file(custom_window_name, namespace, window_type, window_options = {})
window_options ||= {}
window_options[:custom_window_class_name] ||= 'CustomWindow'
namespace_type = class_name(namespace) == class_name(current_dir_name) ? 'class' : 'module'
- 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
Class Scaffold
has 28 methods (exceeds 20 allowed). Consider refactoring. Open
class Scaffold
class << self
include FileUtils
VERSION = File.read(File.expand_path('../../../../VERSION', __FILE__)).strip
Method custom_window_gem
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
def custom_window_gem(custom_window_name, namespace)
gem_name = "glimmer-libui-cw-#{custom_window_name.underscore}"
gem_summary = "#{human_name(custom_window_name)} - Glimmer Custom Window"
begin
custom_window_keyword = dsl_control_name(custom_window_name)
Method custom_window_gem
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def custom_window_gem(custom_window_name, namespace)
gem_name = "glimmer-libui-cw-#{custom_window_name.underscore}"
gem_summary = "#{human_name(custom_window_name)} - Glimmer Custom Window"
begin
custom_window_keyword = dsl_control_name(custom_window_name)
- 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 common_app
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
def common_app(app_name, window_type = :app, window_options = {})
gem_name = file_name(app_name)
gem_summary = human_name(app_name)
return puts("The directory '#{gem_name}' already exists. Please either remove or pick a different name.") if Dir.exist?(gem_name)
# system "ruby -S gem install bundler --no-document" if OS.windows? # resolves freezing issue with warbler and bundler 2.2.29 included in JRuby
Method custom_shape_gem
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def custom_shape_gem(custom_shape_name, namespace)
gem_name = "glimmer-libui-cs-#{custom_shape_name.underscore}"
gem_summary = "#{human_name(custom_shape_name)} - Glimmer Custom Shape"
if namespace
gem_name += "-#{namespace.underscore}"
- 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 custom_control_gem
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def custom_control_gem(custom_control_name, namespace)
gem_name = "glimmer-libui-cc-#{custom_control_name.underscore}"
gem_summary = "#{human_name(custom_control_name)} - Glimmer Custom Control"
if namespace
gem_name += "-#{namespace.underscore}"
- 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 custom_shape_gem
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def custom_shape_gem(custom_shape_name, namespace)
gem_name = "glimmer-libui-cs-#{custom_shape_name.underscore}"
gem_summary = "#{human_name(custom_shape_name)} - Glimmer Custom Shape"
if namespace
gem_name += "-#{namespace.underscore}"
Method custom_control_gem
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def custom_control_gem(custom_control_name, namespace)
gem_name = "glimmer-libui-cc-#{custom_control_name.underscore}"
gem_summary = "#{human_name(custom_control_name)} - Glimmer Custom Control"
if namespace
gem_name += "-#{namespace.underscore}"
Method common_app
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def common_app(app_name, window_type = :app, window_options = {})
gem_name = file_name(app_name)
gem_summary = human_name(app_name)
return puts("The directory '#{gem_name}' already exists. Please either remove or pick a different name.") if Dir.exist?(gem_name)
# system "ruby -S gem install bundler --no-document" if OS.windows? # resolves freezing issue with warbler and bundler 2.2.29 included in JRuby
- 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 app_model
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def app_model(current_dir_name, namespace = nil)
model_name = 'Greeting'
namespace ||= current_dir_name
root_dir = File.exist?('app') ? 'app' : 'lib'
parent_dir = "#{root_dir}/#{file_name(namespace)}/model"
- 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 custom_shape
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def custom_shape(custom_shape_name, namespace)
namespace ||= current_dir_name
root_dir = File.exist?('app') ? 'app' : 'lib'
parent_dir = "#{root_dir}/#{file_name(namespace)}/view"
return puts("The file '#{parent_dir}/#{file_name(custom_shape_name)}.rb' already exists. Please either remove or pick a different name.") if File.exist?("#{parent_dir}/#{file_name(custom_shape_name)}.rb")
- 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 custom_control
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def custom_control(custom_control_name, namespace)
namespace ||= current_dir_name
root_dir = File.exist?('app') ? 'app' : 'lib'
parent_dir = "#{root_dir}/#{file_name(namespace)}/view"
return puts("The file '#{parent_dir}/#{file_name(custom_control_name)}.rb' already exists. Please either remove or pick a different name.") if File.exist?("#{parent_dir}/#{file_name(custom_control_name)}.rb")
- 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 custom_window
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def custom_window(custom_window_name, namespace, window_type = nil, window_options = {})
namespace ||= current_dir_name
root_dir = File.exist?('app') ? 'app' : 'lib'
parent_dir = "#{root_dir}/#{file_name(namespace)}/view"
return puts("The file '#{parent_dir}/#{file_name(custom_window_name)}.rb' already exists. Please either remove or pick a different name.") if File.exist?("#{parent_dir}/#{file_name(custom_window_name)}.rb")
- 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
Similar blocks of code found in 2 locations. Consider refactoring. Open
def custom_shape_gem(custom_shape_name, namespace)
gem_name = "glimmer-libui-cs-#{custom_shape_name.underscore}"
gem_summary = "#{human_name(custom_shape_name)} - Glimmer Custom Shape"
if namespace
gem_name += "-#{namespace.underscore}"
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 138.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
def custom_control_gem(custom_control_name, namespace)
gem_name = "glimmer-libui-cc-#{custom_control_name.underscore}"
gem_summary = "#{human_name(custom_control_name)} - Glimmer Custom Control"
if namespace
gem_name += "-#{namespace.underscore}"
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 138.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
def custom_control(custom_control_name, namespace)
namespace ||= current_dir_name
root_dir = File.exist?('app') ? 'app' : 'lib'
parent_dir = "#{root_dir}/#{file_name(namespace)}/view"
return puts("The file '#{parent_dir}/#{file_name(custom_control_name)}.rb' already exists. Please either remove or pick a different name.") if File.exist?("#{parent_dir}/#{file_name(custom_control_name)}.rb")
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 61.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
def custom_shape(custom_shape_name, namespace)
namespace ||= current_dir_name
root_dir = File.exist?('app') ? 'app' : 'lib'
parent_dir = "#{root_dir}/#{file_name(namespace)}/view"
return puts("The file '#{parent_dir}/#{file_name(custom_shape_name)}.rb' already exists. Please either remove or pick a different name.") if File.exist?("#{parent_dir}/#{file_name(custom_shape_name)}.rb")
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 61.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76