The document provides information and examples about tools for analyzing code quality, including static analysis, rake stats, reek, and flog. Rake stats provides statistics about code to test ratios. Reek searches for code smells. Flog checks complexity by measuring assignments, branches, and conditionals. Examples show running the tools on sample code and reviewing the outputs.
With code examples from the real world that could give you a stroke.
The slides I used on my talk at t3chFest Madrid 2014.
A talk about Code Quality, Clean Code, and good and bad practices when writing code. A fun walk through the experiences from the real world with some advices and introducing some principles that will help you to write better code.
Managing code quality with SonarQube - Radu VunvuleaITSpark Community
In this session we will discover different metrics that can be used when we want to measure the code quality of a project. To calculate and interpret this metrics we will use SonarQube.
With code examples from the real world that could give you a stroke.
The slides I used on my talk at t3chFest Madrid 2014.
A talk about Code Quality, Clean Code, and good and bad practices when writing code. A fun walk through the experiences from the real world with some advices and introducing some principles that will help you to write better code.
Managing code quality with SonarQube - Radu VunvuleaITSpark Community
In this session we will discover different metrics that can be used when we want to measure the code quality of a project. To calculate and interpret this metrics we will use SonarQube.
Code zu schreiben ist nicht besonders schwierig. Um guten Code zu schreiben braucht es dann schon etwas mehr. Aber erst, wenn man es schafft die hohe Qualität des eigenen Codes einerseits über die Laufzeit längerfristiger Projekte aufrecht zu erhalten und kontinuierlich zu dokumentieren, gewinnt man die Anerkennung und das Vertrauen seines Kunden.
Diese Session diskutiert die Zusammenhänge, die hinter der Qualität von Sourcecode stecken, beschreibt Praktiken - sowohl für das eigene Verhalten, als auch für das (Selbst-) Management von Entwicklerteams und stellt die aktuell verfügbaren Werkzeuge vor, die helfen können, die eigene Codequalität langfristig zu messen, sicher zu stellen und noch zu steigern.
Ramesh Krishnamurthy, CTO at World DevOps Summit 2016Indium Software
Ramesh is one of the eminent speakers in World DevOps Summit 2016, which was scheduled on 21st Oct 2016 at Bellandur, Bangalore. He will share his viewpoint on "Integrating Test Automation in DevOps"
One of the biggest problems of software projects is that, while the practice of software development is commonly thought of as engineering, it is inherently a creative discipline; hence, many things about it are hard to measure. While simple yardsticks like test coverage and cyclomatic complexity are important for code quality, what other metrics can we apply to answer questions about our code? What coding conventions or development practices can we implement to make our code easier to measure? We'll take a tour through some processes and tools you can implement to begin improving code quality in your team or organization, and see what a difference it makes to long-term project maintainability. More importantly, we'll look at how we can move beyond today's tools to answer higher-level questions of code quality. Can 'good code' be quantified?
One of the biggest problems of software projects is that, while the practice of software development is commonly thought of as engineering, it is inherently a creative discipline; hence, many things about it are hard to measure. While simple yardsticks like test coverage and cyclomatic complexity are important for code quality, what other metrics can we apply to answer questions about our code? What coding conventions or development practices can we implement to make our code easier to measure? We'll take a tour through some processes and tools you can implement to begin improving code quality in your team or organization, and see what a difference it makes to long-term project maintainability. More importantly, we'll look at how we can move beyond today's tools to answer higher-level questions of code quality. Can 'good code' be quantified?
The PAC aims to promote engagement between various experts from around the world, to create relevant, value-added content sharing between members. For Neotys, to strengthen our position as a thought leader in load & performance testing.
Since its beginning, the PAC is designed to connect performance experts during a single event. In June, during 24 hours, 20 participants convened exploring several topics on the minds of today’s performance tester such as DevOps, Shift Left/Right, Test Automation, Blockchain and Artificial Intelligence.
Graph-Based Source Code Analysis of JavaScript Repositories Dániel Stein
A graph-based approach to analyze JavaScript source codes, using Neo4j as the graph database backend and ShapeSecurity Shift as the parser.
Hungarian version (presented at a Neo4j meetup): http://www.slideshare.net/steindani/forrskdtrak-grfalap-statikus-analzise
Since its beginning, the Performance Advisory Council aims to promote engagement between various experts from around the world, to create relevant, value-added content sharing between members. For Neotys, to strengthen our position as a thought leader in load & performance testing. During this event, 12 participants convened in Chamonix (France) exploring several topics on the minds of today’s performance tester such as DevOps, Shift Left/Right, Test Automation, Blockchain and Artificial Intelligence.
Code zu schreiben ist nicht besonders schwierig. Um guten Code zu schreiben braucht es dann schon etwas mehr. Aber erst, wenn man es schafft die hohe Qualität des eigenen Codes einerseits über die Laufzeit längerfristiger Projekte aufrecht zu erhalten und kontinuierlich zu dokumentieren, gewinnt man die Anerkennung und das Vertrauen seines Kunden.
Diese Session diskutiert die Zusammenhänge, die hinter der Qualität von Sourcecode stecken, beschreibt Praktiken - sowohl für das eigene Verhalten, als auch für das (Selbst-) Management von Entwicklerteams und stellt die aktuell verfügbaren Werkzeuge vor, die helfen können, die eigene Codequalität langfristig zu messen, sicher zu stellen und noch zu steigern.
Ramesh Krishnamurthy, CTO at World DevOps Summit 2016Indium Software
Ramesh is one of the eminent speakers in World DevOps Summit 2016, which was scheduled on 21st Oct 2016 at Bellandur, Bangalore. He will share his viewpoint on "Integrating Test Automation in DevOps"
One of the biggest problems of software projects is that, while the practice of software development is commonly thought of as engineering, it is inherently a creative discipline; hence, many things about it are hard to measure. While simple yardsticks like test coverage and cyclomatic complexity are important for code quality, what other metrics can we apply to answer questions about our code? What coding conventions or development practices can we implement to make our code easier to measure? We'll take a tour through some processes and tools you can implement to begin improving code quality in your team or organization, and see what a difference it makes to long-term project maintainability. More importantly, we'll look at how we can move beyond today's tools to answer higher-level questions of code quality. Can 'good code' be quantified?
One of the biggest problems of software projects is that, while the practice of software development is commonly thought of as engineering, it is inherently a creative discipline; hence, many things about it are hard to measure. While simple yardsticks like test coverage and cyclomatic complexity are important for code quality, what other metrics can we apply to answer questions about our code? What coding conventions or development practices can we implement to make our code easier to measure? We'll take a tour through some processes and tools you can implement to begin improving code quality in your team or organization, and see what a difference it makes to long-term project maintainability. More importantly, we'll look at how we can move beyond today's tools to answer higher-level questions of code quality. Can 'good code' be quantified?
The PAC aims to promote engagement between various experts from around the world, to create relevant, value-added content sharing between members. For Neotys, to strengthen our position as a thought leader in load & performance testing.
Since its beginning, the PAC is designed to connect performance experts during a single event. In June, during 24 hours, 20 participants convened exploring several topics on the minds of today’s performance tester such as DevOps, Shift Left/Right, Test Automation, Blockchain and Artificial Intelligence.
Graph-Based Source Code Analysis of JavaScript Repositories Dániel Stein
A graph-based approach to analyze JavaScript source codes, using Neo4j as the graph database backend and ShapeSecurity Shift as the parser.
Hungarian version (presented at a Neo4j meetup): http://www.slideshare.net/steindani/forrskdtrak-grfalap-statikus-analzise
Since its beginning, the Performance Advisory Council aims to promote engagement between various experts from around the world, to create relevant, value-added content sharing between members. For Neotys, to strengthen our position as a thought leader in load & performance testing. During this event, 12 participants convened in Chamonix (France) exploring several topics on the minds of today’s performance tester such as DevOps, Shift Left/Right, Test Automation, Blockchain and Artificial Intelligence.
Presentation from Cloud Expo Asia Hong Kong covering the rationale for "Compliance as Code" and how InSpec may be applied to servers, cloud platforms, and much more to keep track of your compliance everywhere.
Enhancing Your Test Automation Scenario Coverage with Selenium - QA or the Hi...Perfecto by Perforce
Success in cross-browser test automation relies on many variables. Today’s reality forces practitioners within DevOps/Agile teams to join effort in assuring quality, removing risks, and releasing fast. To meet these goals, business testers, developers, and test automation engineers need to work together with the proper technology stack that matches their skillset. Join Perfecto’s Chief Evangelist and author, Eran Kinsbruner, in this session as he provides recommendations for high coverage, high reliability, and maintainability of cross-browser test automation. In this session, Eran will walk through the following topics:
- Trends in cross-browser test automation.
- Introduction to test automation using codeless and BDD Selenium tools.
- The material differences between the three approaches: code-based Selenium, BDD, and codeless. Including a live demo of the various approaches.
Transcript: Selling digital books in 2024: Insights from industry leaders - T...BookNet Canada
The publishing industry has been selling digital audiobooks and ebooks for over a decade and has found its groove. What’s changed? What has stayed the same? Where do we go from here? Join a group of leading sales peers from across the industry for a conversation about the lessons learned since the popularization of digital books, best practices, digital book supply chain management, and more.
Link to video recording: https://bnctechforum.ca/sessions/selling-digital-books-in-2024-insights-from-industry-leaders/
Presented by BookNet Canada on May 28, 2024, with support from the Department of Canadian Heritage.
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...UiPathCommunity
💥 Speed, accuracy, and scaling – discover the superpowers of GenAI in action with UiPath Document Understanding and Communications Mining™:
See how to accelerate model training and optimize model performance with active learning
Learn about the latest enhancements to out-of-the-box document processing – with little to no training required
Get an exclusive demo of the new family of UiPath LLMs – GenAI models specialized for processing different types of documents and messages
This is a hands-on session specifically designed for automation developers and AI enthusiasts seeking to enhance their knowledge in leveraging the latest intelligent document processing capabilities offered by UiPath.
Speakers:
👨🏫 Andras Palfi, Senior Product Manager, UiPath
👩🏫 Lenka Dulovicova, Product Program Manager, UiPath
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Ramesh Iyer
In today's fast-changing business world, Companies that adapt and embrace new ideas often need help to keep up with the competition. However, fostering a culture of innovation takes much work. It takes vision, leadership and willingness to take risks in the right proportion. Sachin Dev Duggal, co-founder of Builder.ai, has perfected the art of this balance, creating a company culture where creativity and growth are nurtured at each stage.
"Impact of front-end architecture on development cost", Viktor TurskyiFwdays
I have heard many times that architecture is not important for the front-end. Also, many times I have seen how developers implement features on the front-end just following the standard rules for a framework and think that this is enough to successfully launch the project, and then the project fails. How to prevent this and what approach to choose? I have launched dozens of complex projects and during the talk we will analyze which approaches have worked for me and which have not.
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...James Anderson
Effective Application Security in Software Delivery lifecycle using Deployment Firewall and DBOM
The modern software delivery process (or the CI/CD process) includes many tools, distributed teams, open-source code, and cloud platforms. Constant focus on speed to release software to market, along with the traditional slow and manual security checks has caused gaps in continuous security as an important piece in the software supply chain. Today organizations feel more susceptible to external and internal cyber threats due to the vast attack surface in their applications supply chain and the lack of end-to-end governance and risk management.
The software team must secure its software delivery process to avoid vulnerability and security breaches. This needs to be achieved with existing tool chains and without extensive rework of the delivery processes. This talk will present strategies and techniques for providing visibility into the true risk of the existing vulnerabilities, preventing the introduction of security issues in the software, resolving vulnerabilities in production environments quickly, and capturing the deployment bill of materials (DBOM).
Speakers:
Bob Boule
Robert Boule is a technology enthusiast with PASSION for technology and making things work along with a knack for helping others understand how things work. He comes with around 20 years of solution engineering experience in application security, software continuous delivery, and SaaS platforms. He is known for his dynamic presentations in CI/CD and application security integrated in software delivery lifecycle.
Gopinath Rebala
Gopinath Rebala is the CTO of OpsMx, where he has overall responsibility for the machine learning and data processing architectures for Secure Software Delivery. Gopi also has a strong connection with our customers, leading design and architecture for strategic implementations. Gopi is a frequent speaker and well-known leader in continuous delivery and integrating security into software delivery.
Essentials of Automations: Optimizing FME Workflows with ParametersSafe Software
Are you looking to streamline your workflows and boost your projects’ efficiency? Do you find yourself searching for ways to add flexibility and control over your FME workflows? If so, you’re in the right place.
Join us for an insightful dive into the world of FME parameters, a critical element in optimizing workflow efficiency. This webinar marks the beginning of our three-part “Essentials of Automation” series. This first webinar is designed to equip you with the knowledge and skills to utilize parameters effectively: enhancing the flexibility, maintainability, and user control of your FME projects.
Here’s what you’ll gain:
- Essentials of FME Parameters: Understand the pivotal role of parameters, including Reader/Writer, Transformer, User, and FME Flow categories. Discover how they are the key to unlocking automation and optimization within your workflows.
- Practical Applications in FME Form: Delve into key user parameter types including choice, connections, and file URLs. Allow users to control how a workflow runs, making your workflows more reusable. Learn to import values and deliver the best user experience for your workflows while enhancing accuracy.
- Optimization Strategies in FME Flow: Explore the creation and strategic deployment of parameters in FME Flow, including the use of deployment and geometry parameters, to maximize workflow efficiency.
- Pro Tips for Success: Gain insights on parameterizing connections and leveraging new features like Conditional Visibility for clarity and simplicity.
We’ll wrap up with a glimpse into future webinars, followed by a Q&A session to address your specific questions surrounding this topic.
Don’t miss this opportunity to elevate your FME expertise and drive your projects to new heights of efficiency.
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Jeffrey Haguewood
Sidekick Solutions uses Bonterra Impact Management (fka Social Solutions Apricot) and automation solutions to integrate data for business workflows.
We believe integration and automation are essential to user experience and the promise of efficient work through technology. Automation is the critical ingredient to realizing that full vision. We develop integration products and services for Bonterra Case Management software to support the deployment of automations for a variety of use cases.
This video focuses on the notifications, alerts, and approval requests using Slack for Bonterra Impact Management. The solutions covered in this webinar can also be deployed for Microsoft Teams.
Interested in deploying notification automations for Bonterra Impact Management? Contact us at sales@sidekicksolutionsllc.com to discuss next steps.
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualityInflectra
In this insightful webinar, Inflectra explores how artificial intelligence (AI) is transforming software development and testing. Discover how AI-powered tools are revolutionizing every stage of the software development lifecycle (SDLC), from design and prototyping to testing, deployment, and monitoring.
Learn about:
• The Future of Testing: How AI is shifting testing towards verification, analysis, and higher-level skills, while reducing repetitive tasks.
• Test Automation: How AI-powered test case generation, optimization, and self-healing tests are making testing more efficient and effective.
• Visual Testing: Explore the emerging capabilities of AI in visual testing and how it's set to revolutionize UI verification.
• Inflectra's AI Solutions: See demonstrations of Inflectra's cutting-edge AI tools like the ChatGPT plugin and Azure Open AI platform, designed to streamline your testing process.
Whether you're a developer, tester, or QA professional, this webinar will give you valuable insights into how AI is shaping the future of software delivery.
State of ICS and IoT Cyber Threat Landscape Report 2024 previewPrayukth K V
The IoT and OT threat landscape report has been prepared by the Threat Research Team at Sectrio using data from Sectrio, cyber threat intelligence farming facilities spread across over 85 cities around the world. In addition, Sectrio also runs AI-based advanced threat and payload engagement facilities that serve as sinks to attract and engage sophisticated threat actors, and newer malware including new variants and latent threats that are at an earlier stage of development.
The latest edition of the OT/ICS and IoT security Threat Landscape Report 2024 also covers:
State of global ICS asset and network exposure
Sectoral targets and attacks as well as the cost of ransom
Global APT activity, AI usage, actor and tactic profiles, and implications
Rise in volumes of AI-powered cyberattacks
Major cyber events in 2024
Malware and malicious payload trends
Cyberattack types and targets
Vulnerability exploit attempts on CVEs
Attacks on counties – USA
Expansion of bot farms – how, where, and why
In-depth analysis of the cyber threat landscape across North America, South America, Europe, APAC, and the Middle East
Why are attacks on smart factories rising?
Cyber risk predictions
Axis of attacks – Europe
Systemic attacks in the Middle East
Download the full report from here:
https://sectrio.com/resources/ot-threat-landscape-reports/sectrio-releases-ot-ics-and-iot-security-threat-landscape-report-2024/
DevOps and Testing slides at DASA ConnectKari Kakkonen
My and Rik Marselis slides at 30.5.2024 DASA Connect conference. We discuss about what is testing, then what is agile testing and finally what is Testing in DevOps. Finally we had lovely workshop with the participants trying to find out different ways to think about quality and testing in different parts of the DevOps infinity loop.
JMeter webinar - integration with InfluxDB and GrafanaRTTS
Watch this recorded webinar about real-time monitoring of application performance. See how to integrate Apache JMeter, the open-source leader in performance testing, with InfluxDB, the open-source time-series database, and Grafana, the open-source analytics and visualization application.
In this webinar, we will review the benefits of leveraging InfluxDB and Grafana when executing load tests and demonstrate how these tools are used to visualize performance metrics.
Length: 30 minutes
Session Overview
-------------------------------------------
During this webinar, we will cover the following topics while demonstrating the integrations of JMeter, InfluxDB and Grafana:
- What out-of-the-box solutions are available for real-time monitoring JMeter tests?
- What are the benefits of integrating InfluxDB and Grafana into the load testing stack?
- Which features are provided by Grafana?
- Demonstration of InfluxDB and Grafana using a practice web application
To view the webinar recording, go to:
https://www.rttsweb.com/jmeter-integration-webinar
9. Whole
Team
Collective Coding
Ownership Standard
Test-Driven
Development
Customer Pair Design Planning
Tests Programming Improvement Game
Simple
Design
Continuous Sustainable
Integration Pace
Metaphor
Small
Releases
circa 2001. duplicated from xprogramming.com
10. Collective Coding
Ownership Standard
Test-Driven
Development
Pair Design
Programming Improvement
Simple
Design
Continuous Sustainable
Integration Pace
circa 2001. duplicated from xprogramming.com
29. ~/Data/runway $ find app -name quot;*.rbquot; | xargs reek
quot;app/controllers/actions_controller.rbquot; -- 3 warnings:
ActionsController#action calls current_user.actions multiple times
(Duplication)
ActionsController#action calls params[id] multiple times (Duplication)
ActionsController#actions calls current_user.actions multiple times
(Duplication)
quot;app/controllers/application.rbquot; -- 1 warnings:
ApplicationController#site_version doesn't depend on instance state
(Utility Function)
quot;app/helpers/home_helper.rbquot; -- 1 warnings:
HomeHelper::folder_tab has approx 6 statements (Long Method)
quot;app/models/token.rbquot; -- 21 warnings:
Token#parse_incubation_day_of_the_month refers to base more than self
(Feature Envy)
30. ActionsController#action calls current_user.actions multiple times
(Duplication)
ActionsController#action calls params[id] multiple times (Duplication)
ActionsController#actions calls current_user.actions multiple times
(Duplication)
quot;app/controllers/application.rbquot; -- 1 warnings:
ApplicationController#site_version doesn't depend on instance state
(Utility Function)
quot;app/helpers/home_helper.rbquot; -- 1 warnings:
HomeHelper::folder_tab has approx 6 statements (Long Method)
quot;app/models/token.rbquot; -- 21 warnings:
Token#parse_incubation_day_of_the_month refers to base more than self
(Feature Envy)
31. [Feature Envy] Element#update_from refers to
response more than self
def parse_incubation_day_of_the_month
if @remainder =~ /^(d+)(th|st|nd|rd)$/i
day = $1.to_i
base = day <= @today.day ? @today >> 1 : @today
day -=1 until Date.valid_civil?(base.year, base.month, day)
Date.new(base.year, base.month, day)
end
end
59. ~/Data/runway $ flay app
[Processing files...]
Total score (lower is better) = 286
1) Similar code found in :defn (mass = 60)
app/controllers/signups_controller.rb:5
app/controllers/user_sessions_controller.rb:6
2) Similar code found in :if (mass = 54)
app/controllers/forgot_passwords_controller.rb:15
app/controllers/signups_controller.rb:16
3) Similar code found in :defn (mass = 50)
app/helpers/actions_helper.rb:43
app/helpers/actions_helper.rb:49
[More content removed...]
60. ~/Data/runway $ flay app
[Processing files...]
Total score (lower is better) = 286
1) Similar code found in :defn (mass = 60)
app/controllers/signups_controller.rb:5
app/controllers/user_sessions_controller.rb:6
2) Similar code found in :if (mass = 54)
app/controllers/forgot_passwords_controller.rb:15
app/controllers/signups_controller.rb:16
3) Similar code found in :defn (mass = 50)
app/helpers/actions_helper.rb:43
app/helpers/actions_helper.rb:49
[More content removed...]
61. 1) Similar code found in :defn (mass = 60)
app/controllers/signups_controller.rb:5
app/controllers/user_sessions_controller.rb:6
def create
user = User.new(params[:signup])
if user.save
head(:status => :created, :location => home_path)
else
head(:status => :unprocessable_entity)
end
end
def create
user_session = UserSession.new(params[:user_session])
if user_session.save
head(:status => :created, :location => home_path)
else
head(:status => :unprocessable_entity)
end
end
69. lib/tasks/quality.rake
require 'flay'
desc quot;Analyze for code duplicationquot;
task :flay do
threshold = 25
flay = Flay.new({:fuzzy => false, :verbose => false, :mass =>
threshold})
flay.process(*Flay.expand_dirs_to_files(['app']))
flay.report
raise quot;#{flay.masses.size} chunks of code have a duplicate mass >
#{threshold}quot; unless flay.masses.empty?
end
70. ~/Data/runway $ rake flay
(in /Users/marty/Data/runway)
Total score (lower is better) = 164
1) Similar code found in :defn (mass = 60)
app/controllers/signups_controller.rb:5
app/controllers/user_sessions_controller.rb:6
2) Similar code found in :if (mass = 54)
app/controllers/forgot_passwords_controller.rb:15
app/controllers/signups_controller.rb:16
3) Similar code found in :defn (mass = 50)
app/helpers/actions_helper.rb:43
app/helpers/actions_helper.rb:49
rake aborted!
3 chunks of code have a duplicate mass > 25
74. Class Name Block Cyclomatic Complexity
Method Name Method Cyclomatic
Complexity
Module Name
Assignment In Conditional
Class Line Count
Case Missing Else
Method Line Count
Empty Rescue Body
Module Line Count
For Loop Check
Parameter Number
77. ~/Data/runway $ roodi quot;app/**/*.rbquot;
app/models/action_format.rb:10
Method name quot;formatquot; has a cyclomatic complexity is 12.
It should be 8 or less.
app/models/action_parser.rb:50
Block cyclomatic complexity is 11.
It should be 4 or less.
app/models/action.rb:107
Case statement is missing an else clause.
app/models/action.rb:103
Method quot;apply_defaults_from_namequot; has 23 lines.
It should have 20 or less.
app/controllers/application.rb:52
Found = in conditional.
It should probably be an ==
78. Method name quot;formatquot; has a cyclomatic complexit
It should be 8 or less.
app/models/action_parser.rb:50
Block cyclomatic complexity is 11.
It should be 4 or less.
app/models/action.rb:107
Case statement is missing an else clause.
app/models/action.rb:103
Method quot;apply_defaults_from_namequot; has 23 lines.
It should have 20 or less.
app/controllers/application.rb:52
Found = in conditional.
It should probably be an ==
79. app/models/action_parser.rb:50
Block cyclomatic complexity is 11.
It should be 4 or less.
meta.each do |token|
case token.klass
when :context
unless token.value.blank?
@contexts ||= []
@contexts << token.value
end
when :time
@time = token.value
when :energy
@energy = token.value
when :tag
@tags << token.value unless token.value.blank?
when :semi_colon
# Ignore
when :available, :today, :later, :done
@status = token.klass.to_s
@effective_at = token.value
when :due_at
@due_at = token.value
end
end
80. app/models/action_parser.rb:50
Block cyclomatic complexity is 11.
It should be 4 or less.
1 meta.each do |token|
case token.klass
2 when :context
3 unless token.value.blank?
@contexts ||= [] 4
@contexts << token.value
end
5 when :time
@time = token.value
6 when :energy
@energy = token.value
7 8
when :tag
@tags << token.value unless token.value.blank?
9 when :semi_colon
# Ignore
10 when :available, :today, :later, :done
@status = token.klass.to_s
@effective_at = token.value
11 when :due_at
@due_at = token.value
end
end
81. app/controllers/application.rb:52
Found = in conditional.
It should probably be an ==
def extract_authenticity_token
if token = request.headers[quot;HTTP_X_RUNWAY_AUTHENTICITY_TOKENquot;]
params[request_forgery_protection_token] = token
end
end
85. def match(conditions)
conditions = validate_conditions(conditions)
# check content of child nodes
if conditions[:content]
if children.empty?
return false unless match_condition(quot;quot;, conditions[:content])
else
return false unless children.find { |child| child.match(conditions[:content]) }
end
end
# test the name
return false unless match_condition(@name, conditions[:tag]) if conditions[:tag]
# test attributes
(conditions[:attributes] || {}).each do |key, value|
return false unless match_condition(self[key], value)
end
# test parent
return false unless parent.match(conditions[:parent]) if conditions[:parent]
# test children
return false unless children.find { |child| child.match(conditions[:child]) } if conditio
# test ancestors
if conditions[:ancestor]
return false unless catch :found do
p = self
throw :found, true if p.match(conditions[:ancestor]) while p = p.parent
end
end
# test descendants
86. # test descendants
if conditions[:descendant]
return false unless children.find do |child|
# test the child
child.match(conditions[:descendant]) ||
# test the child's descendants
child.match(:descendant => conditions[:descendant])
end
end
# count children
if opts = conditions[:children]
matches = children.select do |c|
(c.kind_of?(HTML::Tag) and (c.closing == :self or ! c.childless?))
end
matches = matches.select { |c| c.match(opts[:only]) } if opts[:only]
opts.each do |key, value|
next if key == :only
case key
when :count
if Integer === value
return false if matches.length != value
else
return false unless value.include?(matches.length)
end
when :less_than
return false unless matches.length < value
when :greater_than
return false unless matches.length > value
else raise quot;unknown count condition #{key}quot;
end
end
end
87. else raise quot;unknown count condition #{key}quot;
end
end
end
# test siblings
if conditions[:sibling] || conditions[:before] || conditions[:after]
siblings = parent ? parent.children : []
self_index = siblings.index(self)
if conditions[:sibling]
return false unless siblings.detect do |s|
s != self && s.match(conditions[:sibling])
end
end
if conditions[:before]
return false unless siblings[self_index+1..-1].detect do |s|
s != self && s.match(conditions[:before])
end
end
if conditions[:after]
return false unless siblings[0,self_index].detect do |s|
s != self && s.match(conditions[:after])
end
end
end
true
end
91. ~/Data/runway $ rake roodi
(in /Users/marty/Data/runway)
app/models/action_format.rb:10 - Method name quot;formatquot; cyclomatic
complexity is 12. It should be 10 or less.
app/models/action_parser.rb:11 - Method name quot;attributesquot; cyclomatic
complexity is 12. It should be 10 or less.
app/models/action_parser.rb:30 - Method name quot;parsequot; cyclomatic
complexity is 14. It should be 10 or less.
app/models/token.rb:173 - Method name quot;parse_incubation_datequot;
cyclomatic complexity is 11. It should be 10 or less.
app/models/token.rb:226 - Method name quot;parse_incubation_daysquot;
cyclomatic complexity is 12. It should be 10 or less.
app/models/action_parser.rb:50 - Block cyclomatic complexity is 11.
It should be 8 or less.
app/models/token.rb:11 - Block cyclomatic complexity is 10. It should
be 8 or less.
app/models/action.rb:103 - Method quot;apply_defaults_from_namequot; has 23
lines. It should have 20 or less.
app/models/action_parser.rb:30 - Method quot;parsequot; has 23 lines. It
should have 20 or less.
rake aborted!
Found 9 errors.