Install the SonarQube server, go the download page, choose the community edition:
https://www.sonarqube.org/downloads/
Add Jacoco plugin in POM.xml:
<build>Install the SonarQube server, go the download page, choose the community edition:
https://www.sonarqube.org/downloads/
Add Jacoco plugin in POM.xml:
<build>http://martinfowler.com/books/refactoring.html
Five or six years ago I was working on an essay about refactoring CSS. I didn't do that, but I did find these notes while working on something new. Hope they're useful! —Dean
p7 "When you find you have to add a feature to a program, and the program's code is not structured in a convenient way to add the feature, first refactor the program to make it easy to add the feature, then add the feature."
p7
Interactive shell: When reads commands from user input on a tty (prompt).
--interactive sources --> /etc/bash.bashrc and ~/.bashrc
Login shell: When a login prompt is required.
--login sources --> /etc/profile and ~/.profile
Interactive non-login shell: Open a new terminal.
--it sources ~/.bashrc
Uncle Bob blogou no Clean Coder sobre uns code reviews que ele fez do código (e das refatorações) de um cara chamado John MacIntyre.
Uncle Bob criticou a conclusão do cara de que refatoração não vale a pena para projetos reais: refatoração é uma maneira efetiva de evitar que o código apodreça e fique difícil de manter.
O que achei de mais interessante sobre o post do Uncle Bob é que ele pegou o código inicial do cara e foi fazendo pequenas refatorações, no estilo Baby Steps. No final, acabou melhorando drasticamente a estrutura do código e tornando-o muito mais extensível. O exemplo é bem pequeno mas, mesmo assim, houve uma melhora significativa.
O código inicial:
| def recursive_fib(n): | |
| if n <= 1: | |
| return n | |
| return recursive_fib(n - 2) + recursive_fib(n - 1) | |
| def memoized_fib(n): | |
| f = [0] * (n + 1) | |
| f[0] = 0 | |
| f[1] = 1 |
| https://www.competa.com/blog/how-to-run-npm-without-sudo/ | |
| npm config set prefix ~/.npm | |
| # open your .bashrc (Linux) or .bash_profile (Mac) file for editing: | |
| nano ~/.bashrc # for Linux | |
| # or... | |
| nano ~/.bash_profile # for Mac if you haven't created a .bashrc file | |
| # add these lines: |
| function cnpj(s) { | |
| let cnpj = s.replace(/[^\d]+/g, '') | |
| // Valida a quantidade de caracteres | |
| if (cnpj.length !== 14) | |
| return false | |
| // Elimina inválidos com todos os caracteres iguais | |
| if (/^(\d)\1+$/.test(cnpj)) | |
| return false |
| import pymongo | |
| from pymongo import Connection | |
| conn = Connection() | |
| db = conn['myDB'] | |
| collection = db['language'] | |
| #Creating a collection | |
| db.language.insert({"id": "1", "name": "C", "grade":"Boring"}) | |
| db.language.insert({"id": "2", "name":"Python", "grade":"Interesting"}) |