SlideShare ist ein Scribd-Unternehmen logo
1 von 17
Downloaden Sie, um offline zu lesen
Fighting Code Smell
   with RubyMine


    Dennis Ushakov
     Oleg Shpynov




      www.jetbrains.com
Goals of this workshop
• Show available code quality tools
• How do they work
• Show what RubyMine can offer




                 www.jetbrains.com    2
Working with code
                                  20%
                                  Write new code


                                  80%
                                  Modify existing
                                  code: bugfixes,
                                  optimizations,
                                  etc.
              www.jetbrains.com                     3
Code quality tools


                 Reek
              Flay Flog
          Roodi Dust Heckle
              Metrics_fu
       RSpec Cucumber Autotest
           RCov SimpleCov


               www.jetbrains.com   4
Code quality tools
• Static
• Runtime




               www.jetbrains.com   5
Static tools

• Inspect your code without launching it
•100% side effects free
•Easy to use

•Challenging to implement
•Rails DSL magic kills ‘em
•Ruby has no formal specification

                  www.jetbrains.com        6
Runtime tools

• Inspect your code by launching it
•100% follow the way Ruby works
•Cope well with Rails DSL

•MAY have side effects
•Works until the very first failure


                    www.jetbrains.com   7
Code that smells
• Runtime errors
• Runtime warnings (like parens in calls etc.)
• Dead code
• Copy/paste
• Complex method bodies
• Code style violations (i.e. naming
  conventions, etc)
• Framework pattern violations (MVC pattern
  violations)
                  www.jetbrains.com          8
Metrics
• Reek
   – Uncommunicative name
   – One char name
   – Name ends with number
   – Camelcase variable
   – instance_of?, kind_of?, is_a? instead of
     polymorphism
   – Duplication
   – Long class, method, parameter list
   – Nested iterators

                      www.jetbrains.com         9
Metrics
• Flog
   – Assignment Branch Call metrics
• Saikuro
   – Cyclomatic complexity
• Roodi
   – Assignment in condition
   – Missing else in case
   – Long class/module/method
   – Class/module/method name check
   – Cyclomatic complexity
• Flay
   – Duplicates
                      www.jetbrains.com   10
Testing and Coverage tools
•   RSpec
•   Cucumber
•   Autotest
•   RCov, SimpleCov
•   Continuous integration
•   Heckle
     – Change code (if <-> unless, calls, numbers,
       assignments, etc.) to see if test fail



                       www.jetbrains.com             11
Practice




www.jetbrains.com   12
What else can be done?
All these tools use Abstract Syntax Tree, but this is not
   all the information that can be extracted!

The main problem is Ruby object model complexity

LEXICAL analysis
• Lexer -> Parser -> Abstract Syntax Tree -> Control
  Flow Graph -> Data Flow Analysis




                       www.jetbrains.com                13
RubyMine
•   On the fly code inspections
•   Code duplicates
•   Test tools integration with graphical UI
•   Coverage tool integration
•   Everything is tightly integrated in IDE




                    www.jetbrains.com          14
GO AND TRY!
jetbrains.com/ruby


     www.jetbrains.com   15
Thank you!
•   Visit us               http://www.jetbrains.com/ruby
•   Read about           http://blogs.jetbrains.com/ruby/
•   Post bugs http://youtrack.jetbrains.net/issues/RUBY
•   Follow us on twitter                      @rubymine




                        www.jetbrains.com               16
Develop with pleasure!


Dennis.Ushakov@jetbrains.com              @en_dal
Oleg.Shpynov@jetbrains.com                @oleg_s




                 www.jetbrains.com
                                     Copyrights are retained by their respective owners

Weitere ähnliche Inhalte

Was ist angesagt?

FITC - Here Be Dragons: Advanced JavaScript Debugging
FITC - Here Be Dragons: Advanced JavaScript DebuggingFITC - Here Be Dragons: Advanced JavaScript Debugging
FITC - Here Be Dragons: Advanced JavaScript DebuggingRami Sayar
 
Shootout! template engines on the jvm
Shootout! template engines on the jvmShootout! template engines on the jvm
Shootout! template engines on the jvmNLJUG
 
Saving Time By Testing With Jest
Saving Time By Testing With JestSaving Time By Testing With Jest
Saving Time By Testing With JestBen McCormick
 
Web development basics (Part-6)
Web development basics (Part-6)Web development basics (Part-6)
Web development basics (Part-6)Rajat Pratap Singh
 
Day 1 - Intro to Ruby
Day 1 - Intro to RubyDay 1 - Intro to Ruby
Day 1 - Intro to RubyBarry Jones
 
Automating Your Daily Tasks with Scripting - RubyConf 2015 Taiwan
Automating Your Daily Tasks with Scripting - RubyConf 2015 TaiwanAutomating Your Daily Tasks with Scripting - RubyConf 2015 Taiwan
Automating Your Daily Tasks with Scripting - RubyConf 2015 TaiwanAdler Hsieh
 
Avoiding Common Pitfalls in Ember.js
Avoiding Common Pitfalls in Ember.jsAvoiding Common Pitfalls in Ember.js
Avoiding Common Pitfalls in Ember.jsAlex Speller
 
Model with actors and implement with Akka
Model with actors and implement with AkkaModel with actors and implement with Akka
Model with actors and implement with AkkaNgoc Dao
 
How to start using Scala
How to start using ScalaHow to start using Scala
How to start using ScalaNgoc Dao
 
Ruby onrails cucumber-rspec-capybara
Ruby onrails cucumber-rspec-capybaraRuby onrails cucumber-rspec-capybara
Ruby onrails cucumber-rspec-capybaraBindesh Vijayan
 
Ruby performance - The low hanging fruit
Ruby performance - The low hanging fruitRuby performance - The low hanging fruit
Ruby performance - The low hanging fruitBruce Werdschinski
 
Web development basics (Part-2)
Web development basics (Part-2)Web development basics (Part-2)
Web development basics (Part-2)Rajat Pratap Singh
 
The Ruby Racer: under the hood
The Ruby Racer: under the hoodThe Ruby Racer: under the hood
The Ruby Racer: under the hoodcowboyd
 
Day 9 - PostgreSQL Application Architecture
Day 9 - PostgreSQL Application ArchitectureDay 9 - PostgreSQL Application Architecture
Day 9 - PostgreSQL Application ArchitectureBarry Jones
 
The Transparent Web: Bridging the Chasm in Web Development
The Transparent Web: Bridging the Chasm in Web DevelopmentThe Transparent Web: Bridging the Chasm in Web Development
The Transparent Web: Bridging the Chasm in Web Developmenttwopoint718
 
Back to the future: Isomorphic javascript applications
Back to the future:  Isomorphic javascript applicationsBack to the future:  Isomorphic javascript applications
Back to the future: Isomorphic javascript applicationsLuciano Colosio
 
Essential ElixirScript - Roman Senin
Essential ElixirScript - Roman SeninEssential ElixirScript - Roman Senin
Essential ElixirScript - Roman SeninElixir Club
 

Was ist angesagt? (20)

Merb
MerbMerb
Merb
 
FITC - Here Be Dragons: Advanced JavaScript Debugging
FITC - Here Be Dragons: Advanced JavaScript DebuggingFITC - Here Be Dragons: Advanced JavaScript Debugging
FITC - Here Be Dragons: Advanced JavaScript Debugging
 
Shootout! template engines on the jvm
Shootout! template engines on the jvmShootout! template engines on the jvm
Shootout! template engines on the jvm
 
Saving Time By Testing With Jest
Saving Time By Testing With JestSaving Time By Testing With Jest
Saving Time By Testing With Jest
 
Web development basics (Part-6)
Web development basics (Part-6)Web development basics (Part-6)
Web development basics (Part-6)
 
Day 1 - Intro to Ruby
Day 1 - Intro to RubyDay 1 - Intro to Ruby
Day 1 - Intro to Ruby
 
Automating Your Daily Tasks with Scripting - RubyConf 2015 Taiwan
Automating Your Daily Tasks with Scripting - RubyConf 2015 TaiwanAutomating Your Daily Tasks with Scripting - RubyConf 2015 Taiwan
Automating Your Daily Tasks with Scripting - RubyConf 2015 Taiwan
 
Avoiding Common Pitfalls in Ember.js
Avoiding Common Pitfalls in Ember.jsAvoiding Common Pitfalls in Ember.js
Avoiding Common Pitfalls in Ember.js
 
Model with actors and implement with Akka
Model with actors and implement with AkkaModel with actors and implement with Akka
Model with actors and implement with Akka
 
How to start using Scala
How to start using ScalaHow to start using Scala
How to start using Scala
 
Ruby onrails cucumber-rspec-capybara
Ruby onrails cucumber-rspec-capybaraRuby onrails cucumber-rspec-capybara
Ruby onrails cucumber-rspec-capybara
 
Ruby performance - The low hanging fruit
Ruby performance - The low hanging fruitRuby performance - The low hanging fruit
Ruby performance - The low hanging fruit
 
Web development basics (Part-2)
Web development basics (Part-2)Web development basics (Part-2)
Web development basics (Part-2)
 
The Ruby Racer: under the hood
The Ruby Racer: under the hoodThe Ruby Racer: under the hood
The Ruby Racer: under the hood
 
Thymeleaf, will it blend?
Thymeleaf, will it blend?Thymeleaf, will it blend?
Thymeleaf, will it blend?
 
Day 9 - PostgreSQL Application Architecture
Day 9 - PostgreSQL Application ArchitectureDay 9 - PostgreSQL Application Architecture
Day 9 - PostgreSQL Application Architecture
 
The Transparent Web: Bridging the Chasm in Web Development
The Transparent Web: Bridging the Chasm in Web DevelopmentThe Transparent Web: Bridging the Chasm in Web Development
The Transparent Web: Bridging the Chasm in Web Development
 
Back to the future: Isomorphic javascript applications
Back to the future:  Isomorphic javascript applicationsBack to the future:  Isomorphic javascript applications
Back to the future: Isomorphic javascript applications
 
Gemboys
GemboysGemboys
Gemboys
 
Essential ElixirScript - Roman Senin
Essential ElixirScript - Roman SeninEssential ElixirScript - Roman Senin
Essential ElixirScript - Roman Senin
 

Andere mochten auch

Piotr Szotkowski about "Ruby smells"
Piotr Szotkowski about "Ruby smells"Piotr Szotkowski about "Ruby smells"
Piotr Szotkowski about "Ruby smells"Pivorak MeetUp
 
Regresion aleatoria siboney
Regresion aleatoria siboneyRegresion aleatoria siboney
Regresion aleatoria siboneycriollito
 
PPAI 2012: Best of Show
PPAI 2012: Best of ShowPPAI 2012: Best of Show
PPAI 2012: Best of ShowImage Source
 
5 Reasons Why Your Email Marketing Sucks - With Sendible & Contactually
5 Reasons Why Your Email Marketing Sucks - With Sendible & Contactually5 Reasons Why Your Email Marketing Sucks - With Sendible & Contactually
5 Reasons Why Your Email Marketing Sucks - With Sendible & ContactuallySendible
 
Ejercicios de integrales
Ejercicios de integralesEjercicios de integrales
Ejercicios de integralesHomer Vasquez
 
THE JUSTICE LEAGE
THE JUSTICE LEAGETHE JUSTICE LEAGE
THE JUSTICE LEAGEPIPELON0412
 
C:\Fakepath\Seis Sombreros Para Pensar De Bono Aplicados
C:\Fakepath\Seis Sombreros Para Pensar De Bono AplicadosC:\Fakepath\Seis Sombreros Para Pensar De Bono Aplicados
C:\Fakepath\Seis Sombreros Para Pensar De Bono AplicadosPedro
 
Pin, Like, or Follow? A Social Media Lunch for Nonprofit Leaders
Pin, Like, or Follow? A Social Media Lunch for Nonprofit LeadersPin, Like, or Follow? A Social Media Lunch for Nonprofit Leaders
Pin, Like, or Follow? A Social Media Lunch for Nonprofit LeadersJoseph LaMountain
 
E2EVC Server 2012 R2, what's new Keynote
E2EVC Server 2012 R2, what's new KeynoteE2EVC Server 2012 R2, what's new Keynote
E2EVC Server 2012 R2, what's new KeynoteMichael Rüefli
 
You have Office 365! Now what?
You have Office 365! Now what?You have Office 365! Now what?
You have Office 365! Now what?KieferConsulting
 
Revista vive mas! enero febrero 2015
Revista vive mas! enero febrero 2015Revista vive mas! enero febrero 2015
Revista vive mas! enero febrero 2015RevistaViveMas
 
Key note Ramon Vullings ideaDJ HTGF FD11 newshoestoday
Key note Ramon Vullings ideaDJ HTGF FD11 newshoestodayKey note Ramon Vullings ideaDJ HTGF FD11 newshoestoday
Key note Ramon Vullings ideaDJ HTGF FD11 newshoestodaynew shoes today
 
Fernando Antonio Ruano Faxas. Comunicación, Empresa, Imagen, Management, Gere...
Fernando Antonio Ruano Faxas. Comunicación, Empresa, Imagen, Management, Gere...Fernando Antonio Ruano Faxas. Comunicación, Empresa, Imagen, Management, Gere...
Fernando Antonio Ruano Faxas. Comunicación, Empresa, Imagen, Management, Gere...Fernando Antonio Ruano Faxas
 
As run energy efficiency of cooling towers
As run energy efficiency of cooling towersAs run energy efficiency of cooling towers
As run energy efficiency of cooling towersD.Pawan Kumar
 
Dr. adolfo vasquez rocca zygmunt bauman; modernidad liquida y fragilidad hu...
Dr. adolfo vasquez rocca   zygmunt bauman; modernidad liquida y fragilidad hu...Dr. adolfo vasquez rocca   zygmunt bauman; modernidad liquida y fragilidad hu...
Dr. adolfo vasquez rocca zygmunt bauman; modernidad liquida y fragilidad hu...Adolfo Vasquez Rocca
 
Recetas restaurantes de cordoba
Recetas restaurantes de cordobaRecetas restaurantes de cordoba
Recetas restaurantes de cordobafjmd
 
Funciones 10
Funciones 10Funciones 10
Funciones 10jmm63
 

Andere mochten auch (20)

Piotr Szotkowski about "Ruby smells"
Piotr Szotkowski about "Ruby smells"Piotr Szotkowski about "Ruby smells"
Piotr Szotkowski about "Ruby smells"
 
Regresion aleatoria siboney
Regresion aleatoria siboneyRegresion aleatoria siboney
Regresion aleatoria siboney
 
PPAI 2012: Best of Show
PPAI 2012: Best of ShowPPAI 2012: Best of Show
PPAI 2012: Best of Show
 
5 Reasons Why Your Email Marketing Sucks - With Sendible & Contactually
5 Reasons Why Your Email Marketing Sucks - With Sendible & Contactually5 Reasons Why Your Email Marketing Sucks - With Sendible & Contactually
5 Reasons Why Your Email Marketing Sucks - With Sendible & Contactually
 
Ejercicios de integrales
Ejercicios de integralesEjercicios de integrales
Ejercicios de integrales
 
THE JUSTICE LEAGE
THE JUSTICE LEAGETHE JUSTICE LEAGE
THE JUSTICE LEAGE
 
C:\Fakepath\Seis Sombreros Para Pensar De Bono Aplicados
C:\Fakepath\Seis Sombreros Para Pensar De Bono AplicadosC:\Fakepath\Seis Sombreros Para Pensar De Bono Aplicados
C:\Fakepath\Seis Sombreros Para Pensar De Bono Aplicados
 
Pin, Like, or Follow? A Social Media Lunch for Nonprofit Leaders
Pin, Like, or Follow? A Social Media Lunch for Nonprofit LeadersPin, Like, or Follow? A Social Media Lunch for Nonprofit Leaders
Pin, Like, or Follow? A Social Media Lunch for Nonprofit Leaders
 
E2EVC Server 2012 R2, what's new Keynote
E2EVC Server 2012 R2, what's new KeynoteE2EVC Server 2012 R2, what's new Keynote
E2EVC Server 2012 R2, what's new Keynote
 
Eurobarometro 2007 (2)
Eurobarometro 2007 (2)Eurobarometro 2007 (2)
Eurobarometro 2007 (2)
 
You have Office 365! Now what?
You have Office 365! Now what?You have Office 365! Now what?
You have Office 365! Now what?
 
Mimonografia (1)
Mimonografia (1)Mimonografia (1)
Mimonografia (1)
 
Revista vive mas! enero febrero 2015
Revista vive mas! enero febrero 2015Revista vive mas! enero febrero 2015
Revista vive mas! enero febrero 2015
 
Key note Ramon Vullings ideaDJ HTGF FD11 newshoestoday
Key note Ramon Vullings ideaDJ HTGF FD11 newshoestodayKey note Ramon Vullings ideaDJ HTGF FD11 newshoestoday
Key note Ramon Vullings ideaDJ HTGF FD11 newshoestoday
 
Fernando Antonio Ruano Faxas. Comunicación, Empresa, Imagen, Management, Gere...
Fernando Antonio Ruano Faxas. Comunicación, Empresa, Imagen, Management, Gere...Fernando Antonio Ruano Faxas. Comunicación, Empresa, Imagen, Management, Gere...
Fernando Antonio Ruano Faxas. Comunicación, Empresa, Imagen, Management, Gere...
 
As run energy efficiency of cooling towers
As run energy efficiency of cooling towersAs run energy efficiency of cooling towers
As run energy efficiency of cooling towers
 
Dr. adolfo vasquez rocca zygmunt bauman; modernidad liquida y fragilidad hu...
Dr. adolfo vasquez rocca   zygmunt bauman; modernidad liquida y fragilidad hu...Dr. adolfo vasquez rocca   zygmunt bauman; modernidad liquida y fragilidad hu...
Dr. adolfo vasquez rocca zygmunt bauman; modernidad liquida y fragilidad hu...
 
Recetas restaurantes de cordoba
Recetas restaurantes de cordobaRecetas restaurantes de cordoba
Recetas restaurantes de cordoba
 
Funciones 10
Funciones 10Funciones 10
Funciones 10
 
CPHAP 040 Infeccion de vias urinarias
CPHAP 040 Infeccion de vias urinariasCPHAP 040 Infeccion de vias urinarias
CPHAP 040 Infeccion de vias urinarias
 

Ähnlich wie Fighting Ruby code smell

Productive Rails development with RubyMine
Productive Rails development with RubyMineProductive Rails development with RubyMine
Productive Rails development with RubyMineolegshpynov
 
[.Net开发交流会][2010.06.19]better framework better life(吕国宁)
[.Net开发交流会][2010.06.19]better framework better life(吕国宁)[.Net开发交流会][2010.06.19]better framework better life(吕国宁)
[.Net开发交流会][2010.06.19]better framework better life(吕国宁)Shanda innovation institute
 
Better Framework Better Life
Better Framework Better LifeBetter Framework Better Life
Better Framework Better Lifejeffz
 
What rails taught me – Eugene Pirogov
What rails taught me – Eugene PirogovWhat rails taught me – Eugene Pirogov
What rails taught me – Eugene PirogovRuby Meditation
 
Exploring Ruby on Rails and PostgreSQL
Exploring Ruby on Rails and PostgreSQLExploring Ruby on Rails and PostgreSQL
Exploring Ruby on Rails and PostgreSQLBarry Jones
 
SELF - Becoming a Rails Developer - The Rest of the Story
SELF - Becoming a Rails Developer - The Rest of the StorySELF - Becoming a Rails Developer - The Rest of the Story
SELF - Becoming a Rails Developer - The Rest of the StoryNathanial McConnell
 
Ruby on-rails-101-presentation-slides-for-a-five-day-introductory-course-1194...
Ruby on-rails-101-presentation-slides-for-a-five-day-introductory-course-1194...Ruby on-rails-101-presentation-slides-for-a-five-day-introductory-course-1194...
Ruby on-rails-101-presentation-slides-for-a-five-day-introductory-course-1194...Nilesh Panchal
 
WTF TDD?
WTF TDD?WTF TDD?
WTF TDD?jeremyw
 
Better framework, better life
Better framework, better lifeBetter framework, better life
Better framework, better lifeDaniel Lv
 
Polyglot and Poly-paradigm Programming for Better Agility
Polyglot and Poly-paradigm Programming for Better AgilityPolyglot and Poly-paradigm Programming for Better Agility
Polyglot and Poly-paradigm Programming for Better Agilityelliando dias
 
Blackboard DevCon 2012 - Ensuring Code Quality
Blackboard DevCon 2012 - Ensuring Code QualityBlackboard DevCon 2012 - Ensuring Code Quality
Blackboard DevCon 2012 - Ensuring Code QualityNoriaki Tatsumi
 
Enterprise Strength Mobile JavaScript
Enterprise Strength Mobile JavaScriptEnterprise Strength Mobile JavaScript
Enterprise Strength Mobile JavaScriptTroy Miles
 
Web a Quebec - JS Debugging
Web a Quebec - JS DebuggingWeb a Quebec - JS Debugging
Web a Quebec - JS DebuggingRami Sayar
 
Simple Ruby DSL Techniques: Big Project Impact!
Simple Ruby DSL Techniques: Big Project Impact!Simple Ruby DSL Techniques: Big Project Impact!
Simple Ruby DSL Techniques: Big Project Impact!Aman King
 
Testing sad-paths
Testing sad-pathsTesting sad-paths
Testing sad-pathsSolano Labs
 

Ähnlich wie Fighting Ruby code smell (20)

Productive Rails development with RubyMine
Productive Rails development with RubyMineProductive Rails development with RubyMine
Productive Rails development with RubyMine
 
Testing gone-right
Testing gone-rightTesting gone-right
Testing gone-right
 
[.Net开发交流会][2010.06.19]better framework better life(吕国宁)
[.Net开发交流会][2010.06.19]better framework better life(吕国宁)[.Net开发交流会][2010.06.19]better framework better life(吕国宁)
[.Net开发交流会][2010.06.19]better framework better life(吕国宁)
 
Better Framework Better Life
Better Framework Better LifeBetter Framework Better Life
Better Framework Better Life
 
What rails taught me – Eugene Pirogov
What rails taught me – Eugene PirogovWhat rails taught me – Eugene Pirogov
What rails taught me – Eugene Pirogov
 
Exploring Ruby on Rails and PostgreSQL
Exploring Ruby on Rails and PostgreSQLExploring Ruby on Rails and PostgreSQL
Exploring Ruby on Rails and PostgreSQL
 
SELF - Becoming a Rails Developer - The Rest of the Story
SELF - Becoming a Rails Developer - The Rest of the StorySELF - Becoming a Rails Developer - The Rest of the Story
SELF - Becoming a Rails Developer - The Rest of the Story
 
Ruby on-rails-101-presentation-slides-for-a-five-day-introductory-course-1194...
Ruby on-rails-101-presentation-slides-for-a-five-day-introductory-course-1194...Ruby on-rails-101-presentation-slides-for-a-five-day-introductory-course-1194...
Ruby on-rails-101-presentation-slides-for-a-five-day-introductory-course-1194...
 
Polyglot Grails
Polyglot GrailsPolyglot Grails
Polyglot Grails
 
Ruby On Rails
Ruby On RailsRuby On Rails
Ruby On Rails
 
WTF TDD?
WTF TDD?WTF TDD?
WTF TDD?
 
Better framework, better life
Better framework, better lifeBetter framework, better life
Better framework, better life
 
Polyglot and Poly-paradigm Programming for Better Agility
Polyglot and Poly-paradigm Programming for Better AgilityPolyglot and Poly-paradigm Programming for Better Agility
Polyglot and Poly-paradigm Programming for Better Agility
 
Blackboard DevCon 2012 - Ensuring Code Quality
Blackboard DevCon 2012 - Ensuring Code QualityBlackboard DevCon 2012 - Ensuring Code Quality
Blackboard DevCon 2012 - Ensuring Code Quality
 
Enterprise Strength Mobile JavaScript
Enterprise Strength Mobile JavaScriptEnterprise Strength Mobile JavaScript
Enterprise Strength Mobile JavaScript
 
Why Use Rails by Dr Nic
Why Use Rails by  Dr NicWhy Use Rails by  Dr Nic
Why Use Rails by Dr Nic
 
Hanami
HanamiHanami
Hanami
 
Web a Quebec - JS Debugging
Web a Quebec - JS DebuggingWeb a Quebec - JS Debugging
Web a Quebec - JS Debugging
 
Simple Ruby DSL Techniques: Big Project Impact!
Simple Ruby DSL Techniques: Big Project Impact!Simple Ruby DSL Techniques: Big Project Impact!
Simple Ruby DSL Techniques: Big Project Impact!
 
Testing sad-paths
Testing sad-pathsTesting sad-paths
Testing sad-paths
 

Kürzlich hochgeladen

Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?XfilesPro
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 

Kürzlich hochgeladen (20)

Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 

Fighting Ruby code smell

  • 1. Fighting Code Smell with RubyMine Dennis Ushakov Oleg Shpynov www.jetbrains.com
  • 2. Goals of this workshop • Show available code quality tools • How do they work • Show what RubyMine can offer www.jetbrains.com 2
  • 3. Working with code 20% Write new code 80% Modify existing code: bugfixes, optimizations, etc. www.jetbrains.com 3
  • 4. Code quality tools Reek Flay Flog Roodi Dust Heckle Metrics_fu RSpec Cucumber Autotest RCov SimpleCov www.jetbrains.com 4
  • 5. Code quality tools • Static • Runtime www.jetbrains.com 5
  • 6. Static tools • Inspect your code without launching it •100% side effects free •Easy to use •Challenging to implement •Rails DSL magic kills ‘em •Ruby has no formal specification www.jetbrains.com 6
  • 7. Runtime tools • Inspect your code by launching it •100% follow the way Ruby works •Cope well with Rails DSL •MAY have side effects •Works until the very first failure www.jetbrains.com 7
  • 8. Code that smells • Runtime errors • Runtime warnings (like parens in calls etc.) • Dead code • Copy/paste • Complex method bodies • Code style violations (i.e. naming conventions, etc) • Framework pattern violations (MVC pattern violations) www.jetbrains.com 8
  • 9. Metrics • Reek – Uncommunicative name – One char name – Name ends with number – Camelcase variable – instance_of?, kind_of?, is_a? instead of polymorphism – Duplication – Long class, method, parameter list – Nested iterators www.jetbrains.com 9
  • 10. Metrics • Flog – Assignment Branch Call metrics • Saikuro – Cyclomatic complexity • Roodi – Assignment in condition – Missing else in case – Long class/module/method – Class/module/method name check – Cyclomatic complexity • Flay – Duplicates www.jetbrains.com 10
  • 11. Testing and Coverage tools • RSpec • Cucumber • Autotest • RCov, SimpleCov • Continuous integration • Heckle – Change code (if <-> unless, calls, numbers, assignments, etc.) to see if test fail www.jetbrains.com 11
  • 13. What else can be done? All these tools use Abstract Syntax Tree, but this is not all the information that can be extracted! The main problem is Ruby object model complexity LEXICAL analysis • Lexer -> Parser -> Abstract Syntax Tree -> Control Flow Graph -> Data Flow Analysis www.jetbrains.com 13
  • 14. RubyMine • On the fly code inspections • Code duplicates • Test tools integration with graphical UI • Coverage tool integration • Everything is tightly integrated in IDE www.jetbrains.com 14
  • 15. GO AND TRY! jetbrains.com/ruby www.jetbrains.com 15
  • 16. Thank you! • Visit us http://www.jetbrains.com/ruby • Read about http://blogs.jetbrains.com/ruby/ • Post bugs http://youtrack.jetbrains.net/issues/RUBY • Follow us on twitter @rubymine www.jetbrains.com 16
  • 17. Develop with pleasure! Dennis.Ushakov@jetbrains.com @en_dal Oleg.Shpynov@jetbrains.com @oleg_s www.jetbrains.com Copyrights are retained by their respective owners