SlideShare a Scribd company logo
VVV
                         Validation and linting tool

                               Mikko Ohtamaa
                        http://twitter.com/moo9000
                         Python Helsinki meet-up




Tuesday, May 15, 2012
• Validation: HTML validator, CSS validator
                    • Linting: flag suspicious code: catch typing
                        errors, formatting errors



         https://en.wikipedia.org/wiki/Lint_programming_tool

Tuesday, May 15, 2012
foobar = get_magic()

                        try:

                               foobar.doSomething()

                        except:

                               fobar.doSomethingElse()




Tuesday, May 15, 2012
[~/code/vvv/demo]% vvv .

                        Running vvv against .

                        /Users/moo/code/vvv/demo/demo.py
                        validation output:

                        ************* Module demo

                        E0602: 15,4: Undefined variable 'fobar'



Tuesday, May 15, 2012
Why you need VVV

                    • Humans make human errors and are lazy
                    • Good practices must be enforced
                        automatically, continuously
                    • “Disadvantages: Initial setup time required”


Tuesday, May 15, 2012
VVV
                    • Per project configuration files for coding
                        conventions and linting rules
                    • Easy set-up: Automatically install required
                        software
                    • Integration with version control
                    • Support multiple languages (Python,
                        Javascript, CSS, restructured text... more to
                        come)

Tuesday, May 15, 2012
Benefits

                    • No bad code slips thru the commits
                    • Enforce coding conventions across project
                        members easily (esp. in open-ended OSS
                        projects)
                    • Permanent increase in software code
                        quality



Tuesday, May 15, 2012
Automatic enforcement
                        [~/code/vvv/demo]% git status
                        # On branch master
                        # Changes to be committed:
                        #   (use "git reset HEAD <file>..." to unstage)
                        #
                        #! new file:    demo.py
                        #! new file:    moomodule.py
                        #

                        [~/code/vvv/demo]% git commit -m "New cool stuff I typed in eyes
                        folder in 3 seconds"
                        /Users/moo/code/vvv/demo/demo.py
                        /Users/moo/code/vvv/demo/demo.py validation output:
                        ************* Module demo
                        E1101: 8,0: Instance of 'str' has no 'cutHumanInHalf' member

                        To fix validation errors:
                        -----------------------------
                        Python source code did not pass Pylint validator. Please fix
                        issues or disable warnings in .py file itself or validation-
                        options.yaml file.

                        Let's fix these issues, ok? ^_^
                        /Users/moo/code/vvv/demo/moomodule.py
                        VVV validatoin and linting failed




Tuesday, May 15, 2012
Mark-up errors
                        .foo {
                            backgrnd: yellow;
                        }




                        Running vvv against .
                        /Users/moo/code/vvv/demo/demo.py validation output:
                        {vextwarning=false, output=text, lang=en, warning=2,
                        medium=all, profile=css3}
                        W3C CSS Validator results for file:/Users/moo/code/vvv/
                        demo/foobar.css
                        Sorry! We found the following errors (1)
                        URI : file:/Users/moo/code/vvv/demo/foobar.css
                        Line : 2 .foo
                               Property backgrnd doesn&#39;t exist :
                               yellow



Tuesday, May 15, 2012
Coding conventions
                        C0103: 2,4:MagicalObject.doSomething: Invalid name
                        "doSomething" (should match [a-z_][a-z0-9_]{2,30}$)




                                   (PEP-8 for Pythoneers)




Tuesday, May 15, 2012
Generic text validation
                    • Line length
                    • Catch bad tabs and indentation
                    • Catch bad character sets (ISO-8859-1,
                        anyone?)
                    • Catch spooky stuff like ALT+spacebar No
                        Break Space character


Tuesday, May 15, 2012
Usage



Tuesday, May 15, 2012
Install VVV on your
                              computer
                        # Python 3 + virtualenv

                        cd ~
                        virtualenv-3.2 vvv-venv
                        . ~/vvv-venv/bin/activate
                        pip install vvv



Tuesday, May 15, 2012
Add VVV configuration
                      in project root

                    • validation-options.yaml to tell which
                        validators to run with which options
                    • validation-files.yaml for file
                        whitelisting / blacklisting




Tuesday, May 15, 2012
validation-options.yaml
                        # Enforce max line length
                        linelength:
                          length: 250

                        # Python additional configuration

                        pylint:

                          host-python-env: true

                          python3k: true

                          configuration: |

                            [MESSAGES CONTROL]
                            # Disable:
                            # - Missing docstring
                            # :C0112: *Empty docstring*
                            # :R0903: *Too few public methods (%s/%s)*
                            # :R0904: *Too many public methods (%s/%s)*
                            disable = C0111, C0112, R0903, R0904


Tuesday, May 15, 2012
validation-files.yaml
                        # Don't match hidden dotted files/folders
                        # Don't match generated folders
                        # Don't match test data (which is bad
                        intentionally)
                        all: |
                          *
                          !RE:.*/..*|^..*
                          !**/build/**
                          !dist/**
                          !venv
                          !**/__pycache__
                          !*.egg-info
                          !tests/validators
                          !tests/test-installation-environment



Tuesday, May 15, 2012
Run VVV
                        source ~/vvv-venv/bin/activate
                        vvv .



                                        ...or...


                        ~/vvv-venv/bin/vvv .




Tuesday, May 15, 2012
No painful manual
                            installations
                    • VVV will automatically download and install
                        a pile of software in ~/.vvv when run for the
                        first time
                    • VVV gives instructions how to install
                        dependencies which cannot be
                        automatically installed: java, node
                    • Installed on-demand: jshint, CSS validator,
                        pylint, etc.

Tuesday, May 15, 2012
Fighting the laziness



Tuesday, May 15, 2012
Pre-commit hook
                               integration
                        # Run pre-commit hook installation
                        vvv-install-git-pre-commit-hook .



                            Breaking the law (Judas Priest, 1980)
                        git commit --no-verify -m "Those validator hooks
                        prevent me committing crappy code, damn it!"



                                  https://www.youtube.com/watch?v=L397TWLwrUU

Tuesday, May 15, 2012
Continuous integration
                       (.travis.yml)
                        # Snake me baby!
                        language: python

                        python:
                          - "3.2"

                        # - We use logilab.astng trunk until this bug fix is
                        # released http://comments.gmane.org/gmane.comp.python.logilab/1193
                        install:
                          - "pip install hg+http://hg.logilab.org/logilab/astng/"
                          - pip install . --use-mirrors


                        # command to run validation against the code base
                        script: vvv .




Tuesday, May 15, 2012
VVV is here today

                    • Available on PyPi: http://pypi.python.org/
                        pypi/vvv
                    • Available on Github: https://github.com/
                        miohtama/vvv




Tuesday, May 15, 2012
Future
                    • Text-editor background linting when typing
                        (Sublime Edit 2)
                    • Expanded version control integration with
                        SVN, Bazaar and Mercurial
                    • Expanded language support: Java, PHP,
                        CoffeeScript
                    • Expanded user base: you report the bugs
Tuesday, May 15, 2012
Q&A

                    • Mikko Ohtamaa
                    • http://twitter.com/moo9000
                    • http://linkedin.com/in/ohtis
                    • http://opensourcehacker.com

Tuesday, May 15, 2012

More Related Content

Viewers also liked

Plone IDE - the future of Plone development
Plone IDE - the future of Plone developmentPlone IDE - the future of Plone development
Plone IDE - the future of Plone development
Mikko Ohtamaa
 
Tomai materiali na
Tomai materiali naTomai materiali na
Tomai materiali naElena Pezzi
 
Saving Plone from Plone agony
Saving Plone from Plone agonySaving Plone from Plone agony
Saving Plone from Plone agony
Mikko Ohtamaa
 
Quando l'Europa fa la differenza
Quando l'Europa fa la differenzaQuando l'Europa fa la differenza
Quando l'Europa fa la differenza
Elena Pezzi
 
Writing the docs
Writing the docsWriting the docs
Writing the docs
Mikko Ohtamaa
 
Operations security - SyPy Dec 2014 (Sydney Python users)
Operations security - SyPy Dec 2014 (Sydney Python users)Operations security - SyPy Dec 2014 (Sydney Python users)
Operations security - SyPy Dec 2014 (Sydney Python users)
Mikko Ohtamaa
 
Beautiful Maintainable ModularJavascript Codebase with RequireJS - HelsinkiJ...
 Beautiful Maintainable ModularJavascript Codebase with RequireJS - HelsinkiJ... Beautiful Maintainable ModularJavascript Codebase with RequireJS - HelsinkiJ...
Beautiful Maintainable ModularJavascript Codebase with RequireJS - HelsinkiJ...
Mikko Ohtamaa
 
Plone, battle-scarred community with battle tanks
Plone, battle-scarred community with battle tanksPlone, battle-scarred community with battle tanks
Plone, battle-scarred community with battle tanksMikko Ohtamaa
 
Javascript - How to avoid the bad parts
Javascript - How to avoid the bad partsJavascript - How to avoid the bad parts
Javascript - How to avoid the bad parts
Mikko Ohtamaa
 
Operations security (OPSEC)
Operations security (OPSEC)Operations security (OPSEC)
Operations security (OPSEC)
Mikko Ohtamaa
 
Websauna - introduction to the best Python web framework
Websauna - introduction to the best Python web frameworkWebsauna - introduction to the best Python web framework
Websauna - introduction to the best Python web framework
Mikko Ohtamaa
 

Viewers also liked (11)

Plone IDE - the future of Plone development
Plone IDE - the future of Plone developmentPlone IDE - the future of Plone development
Plone IDE - the future of Plone development
 
Tomai materiali na
Tomai materiali naTomai materiali na
Tomai materiali na
 
Saving Plone from Plone agony
Saving Plone from Plone agonySaving Plone from Plone agony
Saving Plone from Plone agony
 
Quando l'Europa fa la differenza
Quando l'Europa fa la differenzaQuando l'Europa fa la differenza
Quando l'Europa fa la differenza
 
Writing the docs
Writing the docsWriting the docs
Writing the docs
 
Operations security - SyPy Dec 2014 (Sydney Python users)
Operations security - SyPy Dec 2014 (Sydney Python users)Operations security - SyPy Dec 2014 (Sydney Python users)
Operations security - SyPy Dec 2014 (Sydney Python users)
 
Beautiful Maintainable ModularJavascript Codebase with RequireJS - HelsinkiJ...
 Beautiful Maintainable ModularJavascript Codebase with RequireJS - HelsinkiJ... Beautiful Maintainable ModularJavascript Codebase with RequireJS - HelsinkiJ...
Beautiful Maintainable ModularJavascript Codebase with RequireJS - HelsinkiJ...
 
Plone, battle-scarred community with battle tanks
Plone, battle-scarred community with battle tanksPlone, battle-scarred community with battle tanks
Plone, battle-scarred community with battle tanks
 
Javascript - How to avoid the bad parts
Javascript - How to avoid the bad partsJavascript - How to avoid the bad parts
Javascript - How to avoid the bad parts
 
Operations security (OPSEC)
Operations security (OPSEC)Operations security (OPSEC)
Operations security (OPSEC)
 
Websauna - introduction to the best Python web framework
Websauna - introduction to the best Python web frameworkWebsauna - introduction to the best Python web framework
Websauna - introduction to the best Python web framework
 

Similar to VVV validation and linting tool

Here Be Dragons – Advanced JavaScript Debugging
Here Be Dragons – Advanced JavaScript DebuggingHere Be Dragons – Advanced JavaScript Debugging
Here Be Dragons – Advanced JavaScript Debugging
FITC
 
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
Rami Sayar
 
VS Debugging Tricks
VS Debugging TricksVS Debugging Tricks
VS Debugging Tricks
Sasha Goldshtein
 
Test driving an MVVM App
Test driving an MVVM AppTest driving an MVVM App
Test driving an MVVM App
Emanuele DelBono
 
Test studiowebinaraugcodedstep
Test studiowebinaraugcodedstepTest studiowebinaraugcodedstep
Test studiowebinaraugcodedstep
Dhananjay Kumar
 
Little Known VC++ Debugging Tricks
Little Known VC++ Debugging TricksLittle Known VC++ Debugging Tricks
Little Known VC++ Debugging Tricks
Ofek Shilon
 
POGen: A Test Code Generator Based on Template Variable Coverage in Gray-Box ...
POGen: A Test Code Generator Based on Template Variable Coverage in Gray-Box ...POGen: A Test Code Generator Based on Template Variable Coverage in Gray-Box ...
POGen: A Test Code Generator Based on Template Variable Coverage in Gray-Box ...
Kazunori Sakamoto
 
QA Fest 2018. Ярослав Пернеровский. Test Automation Pyramid, how it ruins you...
QA Fest 2018. Ярослав Пернеровский. Test Automation Pyramid, how it ruins you...QA Fest 2018. Ярослав Пернеровский. Test Automation Pyramid, how it ruins you...
QA Fest 2018. Ярослав Пернеровский. Test Automation Pyramid, how it ruins you...
QAFest
 
Python and test
Python and testPython and test
Python and test
Micron Technology
 
Continuous Delivery, Continuous Integration
Continuous Delivery, Continuous Integration Continuous Delivery, Continuous Integration
Continuous Delivery, Continuous Integration
Amazon Web Services
 
Stopping the Rot - Putting Legacy C++ Under Test
Stopping the Rot - Putting Legacy C++ Under TestStopping the Rot - Putting Legacy C++ Under Test
Stopping the Rot - Putting Legacy C++ Under Test
Seb Rose
 
Testing in Craft CMS
Testing in Craft CMSTesting in Craft CMS
Testing in Craft CMS
JustinHolt20
 
Test driven development_continuous_integration
Test driven development_continuous_integrationTest driven development_continuous_integration
Test driven development_continuous_integration
haochenglee
 
C# Production Debugging Made Easy
 C# Production Debugging Made Easy C# Production Debugging Made Easy
C# Production Debugging Made Easy
Alon Fliess
 
Codeception introduction and use in Yii
Codeception introduction and use in YiiCodeception introduction and use in Yii
Codeception introduction and use in Yii
IlPeach
 
Implementing Quality on a Java Project
Implementing Quality on a Java ProjectImplementing Quality on a Java Project
Implementing Quality on a Java Project
Vincent Massol
 
Finding and exploiting novel flaws in Java software (SyScan 2015)
Finding and exploiting novel flaws in Java software (SyScan 2015)Finding and exploiting novel flaws in Java software (SyScan 2015)
Finding and exploiting novel flaws in Java software (SyScan 2015)
David Jorm
 
TDD Painkillers
TDD PainkillersTDD Painkillers
TDD Painkillers
Ben Hall
 
Zepplin_Pronko_Magento_Festival Hall 1_Final
Zepplin_Pronko_Magento_Festival Hall 1_FinalZepplin_Pronko_Magento_Festival Hall 1_Final
Zepplin_Pronko_Magento_Festival Hall 1_FinalMax Pronko
 

Similar to VVV validation and linting tool (20)

Here Be Dragons – Advanced JavaScript Debugging
Here Be Dragons – Advanced JavaScript DebuggingHere Be Dragons – Advanced JavaScript Debugging
Here Be Dragons – Advanced JavaScript Debugging
 
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
 
VS Debugging Tricks
VS Debugging TricksVS Debugging Tricks
VS Debugging Tricks
 
Test driving an MVVM App
Test driving an MVVM AppTest driving an MVVM App
Test driving an MVVM App
 
Test studiowebinaraugcodedstep
Test studiowebinaraugcodedstepTest studiowebinaraugcodedstep
Test studiowebinaraugcodedstep
 
Little Known VC++ Debugging Tricks
Little Known VC++ Debugging TricksLittle Known VC++ Debugging Tricks
Little Known VC++ Debugging Tricks
 
POGen: A Test Code Generator Based on Template Variable Coverage in Gray-Box ...
POGen: A Test Code Generator Based on Template Variable Coverage in Gray-Box ...POGen: A Test Code Generator Based on Template Variable Coverage in Gray-Box ...
POGen: A Test Code Generator Based on Template Variable Coverage in Gray-Box ...
 
QA Fest 2018. Ярослав Пернеровский. Test Automation Pyramid, how it ruins you...
QA Fest 2018. Ярослав Пернеровский. Test Automation Pyramid, how it ruins you...QA Fest 2018. Ярослав Пернеровский. Test Automation Pyramid, how it ruins you...
QA Fest 2018. Ярослав Пернеровский. Test Automation Pyramid, how it ruins you...
 
Python and test
Python and testPython and test
Python and test
 
Continuous Delivery, Continuous Integration
Continuous Delivery, Continuous Integration Continuous Delivery, Continuous Integration
Continuous Delivery, Continuous Integration
 
WENLONGZHU
WENLONGZHUWENLONGZHU
WENLONGZHU
 
Stopping the Rot - Putting Legacy C++ Under Test
Stopping the Rot - Putting Legacy C++ Under TestStopping the Rot - Putting Legacy C++ Under Test
Stopping the Rot - Putting Legacy C++ Under Test
 
Testing in Craft CMS
Testing in Craft CMSTesting in Craft CMS
Testing in Craft CMS
 
Test driven development_continuous_integration
Test driven development_continuous_integrationTest driven development_continuous_integration
Test driven development_continuous_integration
 
C# Production Debugging Made Easy
 C# Production Debugging Made Easy C# Production Debugging Made Easy
C# Production Debugging Made Easy
 
Codeception introduction and use in Yii
Codeception introduction and use in YiiCodeception introduction and use in Yii
Codeception introduction and use in Yii
 
Implementing Quality on a Java Project
Implementing Quality on a Java ProjectImplementing Quality on a Java Project
Implementing Quality on a Java Project
 
Finding and exploiting novel flaws in Java software (SyScan 2015)
Finding and exploiting novel flaws in Java software (SyScan 2015)Finding and exploiting novel flaws in Java software (SyScan 2015)
Finding and exploiting novel flaws in Java software (SyScan 2015)
 
TDD Painkillers
TDD PainkillersTDD Painkillers
TDD Painkillers
 
Zepplin_Pronko_Magento_Festival Hall 1_Final
Zepplin_Pronko_Magento_Festival Hall 1_FinalZepplin_Pronko_Magento_Festival Hall 1_Final
Zepplin_Pronko_Magento_Festival Hall 1_Final
 

More from Mikko Ohtamaa

Operations Security - SF Bitcoin Hackday March 2015
Operations Security - SF Bitcoin Hackday March 2015Operations Security - SF Bitcoin Hackday March 2015
Operations Security - SF Bitcoin Hackday March 2015Mikko Ohtamaa
 
World Plone Day 2013
World Plone Day 2013World Plone Day 2013
World Plone Day 2013
Mikko Ohtamaa
 
Test lol
Test lolTest lol
Test lol
Mikko Ohtamaa
 
The Easy Way - Plone Conference 2011
The Easy Way - Plone Conference 2011The Easy Way - Plone Conference 2011
The Easy Way - Plone Conference 2011Mikko Ohtamaa
 
Mobile Landscape 2011
Mobile Landscape 2011Mobile Landscape 2011
Mobile Landscape 2011
Mikko Ohtamaa
 
Mobiilimarkkinoinnin mahdollisuudet nyt
Mobiilimarkkinoinnin mahdollisuudet nytMobiilimarkkinoinnin mahdollisuudet nyt
Mobiilimarkkinoinnin mahdollisuudet nyt
Mikko Ohtamaa
 
The World Outside Plone
The World Outside PloneThe World Outside Plone
The World Outside Plone
Mikko Ohtamaa
 
mFabrik Case Studies
mFabrik Case StudiesmFabrik Case Studies
mFabrik Case Studies
Mikko Ohtamaa
 
Building HTML based mobile phone applications
Building HTML based mobile phone applicationsBuilding HTML based mobile phone applications
Building HTML based mobile phone applications
Mikko Ohtamaa
 

More from Mikko Ohtamaa (9)

Operations Security - SF Bitcoin Hackday March 2015
Operations Security - SF Bitcoin Hackday March 2015Operations Security - SF Bitcoin Hackday March 2015
Operations Security - SF Bitcoin Hackday March 2015
 
World Plone Day 2013
World Plone Day 2013World Plone Day 2013
World Plone Day 2013
 
Test lol
Test lolTest lol
Test lol
 
The Easy Way - Plone Conference 2011
The Easy Way - Plone Conference 2011The Easy Way - Plone Conference 2011
The Easy Way - Plone Conference 2011
 
Mobile Landscape 2011
Mobile Landscape 2011Mobile Landscape 2011
Mobile Landscape 2011
 
Mobiilimarkkinoinnin mahdollisuudet nyt
Mobiilimarkkinoinnin mahdollisuudet nytMobiilimarkkinoinnin mahdollisuudet nyt
Mobiilimarkkinoinnin mahdollisuudet nyt
 
The World Outside Plone
The World Outside PloneThe World Outside Plone
The World Outside Plone
 
mFabrik Case Studies
mFabrik Case StudiesmFabrik Case Studies
mFabrik Case Studies
 
Building HTML based mobile phone applications
Building HTML based mobile phone applicationsBuilding HTML based mobile phone applications
Building HTML based mobile phone applications
 

Recently uploaded

Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
Dorra BARTAGUIZ
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
Alpen-Adria-Universität
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
Pierluigi Pugliese
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
The Metaverse and AI: how can decision-makers harness the Metaverse for their...
The Metaverse and AI: how can decision-makers harness the Metaverse for their...The Metaverse and AI: how can decision-makers harness the Metaverse for their...
The Metaverse and AI: how can decision-makers harness the Metaverse for their...
Jen Stirrup
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Paige Cruz
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdfSAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
Peter Spielvogel
 
Enhancing Performance with Globus and the Science DMZ
Enhancing Performance with Globus and the Science DMZEnhancing Performance with Globus and the Science DMZ
Enhancing Performance with Globus and the Science DMZ
Globus
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
Sri Ambati
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 
Free Complete Python - A step towards Data Science
Free Complete Python - A step towards Data ScienceFree Complete Python - A step towards Data Science
Free Complete Python - A step towards Data Science
RinaMondal9
 
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Nexer Digital
 

Recently uploaded (20)

Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
The Metaverse and AI: how can decision-makers harness the Metaverse for their...
The Metaverse and AI: how can decision-makers harness the Metaverse for their...The Metaverse and AI: how can decision-makers harness the Metaverse for their...
The Metaverse and AI: how can decision-makers harness the Metaverse for their...
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdfSAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
 
Enhancing Performance with Globus and the Science DMZ
Enhancing Performance with Globus and the Science DMZEnhancing Performance with Globus and the Science DMZ
Enhancing Performance with Globus and the Science DMZ
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 
Free Complete Python - A step towards Data Science
Free Complete Python - A step towards Data ScienceFree Complete Python - A step towards Data Science
Free Complete Python - A step towards Data Science
 
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?
 

VVV validation and linting tool

  • 1. VVV Validation and linting tool Mikko Ohtamaa http://twitter.com/moo9000 Python Helsinki meet-up Tuesday, May 15, 2012
  • 2. • Validation: HTML validator, CSS validator • Linting: flag suspicious code: catch typing errors, formatting errors https://en.wikipedia.org/wiki/Lint_programming_tool Tuesday, May 15, 2012
  • 3. foobar = get_magic() try: foobar.doSomething() except: fobar.doSomethingElse() Tuesday, May 15, 2012
  • 4. [~/code/vvv/demo]% vvv . Running vvv against . /Users/moo/code/vvv/demo/demo.py validation output: ************* Module demo E0602: 15,4: Undefined variable 'fobar' Tuesday, May 15, 2012
  • 5. Why you need VVV • Humans make human errors and are lazy • Good practices must be enforced automatically, continuously • “Disadvantages: Initial setup time required” Tuesday, May 15, 2012
  • 6. VVV • Per project configuration files for coding conventions and linting rules • Easy set-up: Automatically install required software • Integration with version control • Support multiple languages (Python, Javascript, CSS, restructured text... more to come) Tuesday, May 15, 2012
  • 7. Benefits • No bad code slips thru the commits • Enforce coding conventions across project members easily (esp. in open-ended OSS projects) • Permanent increase in software code quality Tuesday, May 15, 2012
  • 8. Automatic enforcement [~/code/vvv/demo]% git status # On branch master # Changes to be committed: # (use "git reset HEAD <file>..." to unstage) # #! new file: demo.py #! new file: moomodule.py # [~/code/vvv/demo]% git commit -m "New cool stuff I typed in eyes folder in 3 seconds" /Users/moo/code/vvv/demo/demo.py /Users/moo/code/vvv/demo/demo.py validation output: ************* Module demo E1101: 8,0: Instance of 'str' has no 'cutHumanInHalf' member To fix validation errors: ----------------------------- Python source code did not pass Pylint validator. Please fix issues or disable warnings in .py file itself or validation- options.yaml file. Let's fix these issues, ok? ^_^ /Users/moo/code/vvv/demo/moomodule.py VVV validatoin and linting failed Tuesday, May 15, 2012
  • 9. Mark-up errors .foo { backgrnd: yellow; } Running vvv against . /Users/moo/code/vvv/demo/demo.py validation output: {vextwarning=false, output=text, lang=en, warning=2, medium=all, profile=css3} W3C CSS Validator results for file:/Users/moo/code/vvv/ demo/foobar.css Sorry! We found the following errors (1) URI : file:/Users/moo/code/vvv/demo/foobar.css Line : 2 .foo Property backgrnd doesn&#39;t exist : yellow Tuesday, May 15, 2012
  • 10. Coding conventions C0103: 2,4:MagicalObject.doSomething: Invalid name "doSomething" (should match [a-z_][a-z0-9_]{2,30}$) (PEP-8 for Pythoneers) Tuesday, May 15, 2012
  • 11. Generic text validation • Line length • Catch bad tabs and indentation • Catch bad character sets (ISO-8859-1, anyone?) • Catch spooky stuff like ALT+spacebar No Break Space character Tuesday, May 15, 2012
  • 13. Install VVV on your computer # Python 3 + virtualenv cd ~ virtualenv-3.2 vvv-venv . ~/vvv-venv/bin/activate pip install vvv Tuesday, May 15, 2012
  • 14. Add VVV configuration in project root • validation-options.yaml to tell which validators to run with which options • validation-files.yaml for file whitelisting / blacklisting Tuesday, May 15, 2012
  • 15. validation-options.yaml # Enforce max line length linelength: length: 250 # Python additional configuration pylint: host-python-env: true python3k: true configuration: | [MESSAGES CONTROL] # Disable: # - Missing docstring # :C0112: *Empty docstring* # :R0903: *Too few public methods (%s/%s)* # :R0904: *Too many public methods (%s/%s)* disable = C0111, C0112, R0903, R0904 Tuesday, May 15, 2012
  • 16. validation-files.yaml # Don't match hidden dotted files/folders # Don't match generated folders # Don't match test data (which is bad intentionally) all: | * !RE:.*/..*|^..* !**/build/** !dist/** !venv !**/__pycache__ !*.egg-info !tests/validators !tests/test-installation-environment Tuesday, May 15, 2012
  • 17. Run VVV source ~/vvv-venv/bin/activate vvv . ...or... ~/vvv-venv/bin/vvv . Tuesday, May 15, 2012
  • 18. No painful manual installations • VVV will automatically download and install a pile of software in ~/.vvv when run for the first time • VVV gives instructions how to install dependencies which cannot be automatically installed: java, node • Installed on-demand: jshint, CSS validator, pylint, etc. Tuesday, May 15, 2012
  • 20. Pre-commit hook integration # Run pre-commit hook installation vvv-install-git-pre-commit-hook . Breaking the law (Judas Priest, 1980) git commit --no-verify -m "Those validator hooks prevent me committing crappy code, damn it!" https://www.youtube.com/watch?v=L397TWLwrUU Tuesday, May 15, 2012
  • 21. Continuous integration (.travis.yml) # Snake me baby! language: python python: - "3.2" # - We use logilab.astng trunk until this bug fix is # released http://comments.gmane.org/gmane.comp.python.logilab/1193 install: - "pip install hg+http://hg.logilab.org/logilab/astng/" - pip install . --use-mirrors # command to run validation against the code base script: vvv . Tuesday, May 15, 2012
  • 22. VVV is here today • Available on PyPi: http://pypi.python.org/ pypi/vvv • Available on Github: https://github.com/ miohtama/vvv Tuesday, May 15, 2012
  • 23. Future • Text-editor background linting when typing (Sublime Edit 2) • Expanded version control integration with SVN, Bazaar and Mercurial • Expanded language support: Java, PHP, CoffeeScript • Expanded user base: you report the bugs Tuesday, May 15, 2012
  • 24. Q&A • Mikko Ohtamaa • http://twitter.com/moo9000 • http://linkedin.com/in/ohtis • http://opensourcehacker.com Tuesday, May 15, 2012