$30 off During Our Annual Pro Sale. View Details »

Heartless code review

Heartless code review

rejasupotaro

August 15, 2015
Tweet

More Decks by rejasupotaro

Other Decks in Technology

Transcript

  1. Problem of human code review * Depending on the skill

    * Depending on the mood of the day
  2. It seems that code quality can be checked automatically *

    Improve code quality * Improve UX * Share knowledge
  3. Code bad smell detection * Correctness * Bad practice *

    Malicious code vulnerability * Performance
  4. You can setup formatter with 1 command * Square: ./install.sh

    * Cookpad: curl -L "https://raw.githubusercontent.com/cookpad/android-code-style/ master/.idea/codeStyleSettings.xml" > .idea/codeStyleSettings.xml
  5. FindBugs Find 420+ types of bug Super powerful! Some reports

    are too strict (= false-positive) for Android
  6. developed by Facebook written in OCaml Infer A tool to

    detect bugs in Android and iOS app before they ship
  7. findbugs { toolVersion = "2.0.1" sourceSets = [sourceSets.main] ignoreFailures =

    true reportsDir = file("$project.buildDir/findbugsReports") effort = "max" reportLevel = "high" visitors = ["FindSqlInjection", "SwitchFallthrough"] omitVisitors = ["FindNonShortCircuit"] includeFilter = file(“$rootProject.projectDir/…/includeFilter.xml”) excludeFilter = file(“$rootProject.projectDir/…/excludeFilter.xml”) } All properties have sensible defaults
  8. AlertDialog dialog = new AlertDialog.Builder(context) .setMessage(R.string.message) .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {

    @Override public void onClick(DialogInterface dialog, int which) { … } }) .setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { … } }) .show(); Bug type: SIC_INNER_SHOULD_BE_STATIC_ANON
  9. Advantage * Save the time of code review * Keep

    code high quality * Focus on essential problem
  10. Bots say harsh things to keep code quality high Human

    praise reviewee to motivate team members