├── .gitignore ├── README.md ├── codeCleaningTools └── commentOutUnusedParameters.pl ├── eclipse-tools ├── eclipseProjectMigrator └── install_eclipse.sh ├── formatter ├── eclipse_style.xml └── emacs_style.el └── wiki ├── bs_job.png ├── bs_overview.png ├── build-passed.png └── pr-build-server-status.png /.gitignore: -------------------------------------------------------------------------------- 1 | /.project 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | #### This repository contains tools and a wiki to aid efficient programming and high usability of the resulting software 2 | 3 | See the [wiki](https://github.com/ethz-asl/programming_guidelines/wiki) for more information. 4 | 5 | 6 | -------------------------------------------------------------------------------- /codeCleaningTools/commentOutUnusedParameters.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | use Getopt::Long; 4 | my $force = 0; 5 | my $prefix = ""; 6 | my $help = 0; 7 | my $verbose = 0; 8 | my $debug = 0; 9 | $result = GetOptions ( 10 | "prefix|p=s" => \$prefix, 11 | "replacement|r=s" => \$prefixReplacement, 12 | "force|f" => \$force, 13 | "verbose|v" => \$verbose, 14 | "debug|d" => \$debug, 15 | "help|h|usage|u" => \$help 16 | ) 17 | or $help = 1; 18 | 19 | if($help){ 20 | print "USAGE: $ARGV[0] [(-h|--help)] | [-f|--force] [-v|--verbose] [-p|--prefix ] [-r|--replacement ] []\n"; 21 | exit(-1); 22 | } 23 | 24 | #Just feed in build output on stdin. 25 | #Tested mostly with Jenkins raw build output (http://129.132.38.183:8080/job/????/consoleText). 26 | #runs best directly in the git work tree. 27 | 28 | #use the two first positional arguments to replace path prefixes: 29 | 30 | %ids=(); 31 | 32 | $pwd = $ENV{'PWD'}; 33 | $currentRev = qx(git rev-parse HEAD); 34 | 35 | if(!$currentRev) { 36 | print STDERR "WARNING: Could not retrieve current git revision! Please ensure manually that the code is identical to the compiled one!"; 37 | }else{ 38 | $currentRev =~s/\s+$//; 39 | print "Current commit : '$currentRev'.\n"; 40 | } 41 | 42 | $revisionOk = 0; 43 | 44 | while (<>){ 45 | $line = $_; 46 | if($line =~/^ *Checking out Revision /){ 47 | my ($rev, $rest) = ($line =~/^ *Checking out Revision *([[:alnum:]]+)(.*)/i); 48 | if($rest){ 49 | print "Jenkins used commit '$rev'.\n"; 50 | if($currentRev && $currentRev ne $rev){ 51 | print STDERR "Don't use compiler warnings from a different commit ($rev (Jenkins) != $currentRev ($pwd)! The line numbers may not match.\nTip: checkout commit $rev first!\n"; 52 | if(!$force) { exit -1; } 53 | } 54 | } 55 | } 56 | elsif($line=~/warning: unused\ parameter/) { 57 | my ($status, $file, $lineNr, $name) = ($line =~/^(\[ *\d*%\])? *([^:]*):(\d\d*).*warning: unused parameter [‘?](\S*)[’?]/i); 58 | if($file) { 59 | $id = "$file:$lineNr:$name"; 60 | if($ids{$id}) { 61 | !$verbose or print "skipping duplicate : $id\n"; 62 | next; 63 | } 64 | else { $ids{$id} = 1;} 65 | 66 | if(index($file, $prefix) == 0){ 67 | $file=~ s/^\Q$prefix\E/$prefixReplacement/; 68 | !$verbose or print "processing unused parameter $id in $file\n"; 69 | 70 | if( -e $file ){ 71 | $testAlreadyCmd = "sed -n '${lineNr},/{/p' '$file' | sed -n '\\#/\\* *$name *\\*/#q1; /{/q0'"; 72 | $ret = system($testAlreadyCmd); 73 | !$debug or print "testing whether already applied with : $testAlreadyCmd -> $ret\n"; 74 | if($ret eq 256) { 75 | print "replacing '$name' : already applied.\n"; 76 | }else { 77 | $matcher = "$name\\( *\\([,)=]\\|\$\\)\\)"; 78 | $cmd = "sed -n '${lineNr},/{/p' '$file' | sed -n '\\#$matcher#q1'"; 79 | $ret = system($cmd); 80 | !$debug or print "testing whether we can replace with : $cmd -> $ret\n"; 81 | if($ret eq 256){ 82 | $replacement = "/* $name */"; 83 | print "replacing '$name' with '$replacement'.\n"; 84 | system("sed -i '${lineNr},/{/{s#$matcher#$replacement\\1#; t quit; b}; b; :quit; n; b quit' '$file'"); 85 | }else{ 86 | print STDERR "$file:$lineNr :"; 87 | print STDERR "'WARNING: failed to replace '$name' in:\n"; 88 | system("sed -n '${lineNr},/{/p' '$file' >&2"); 89 | print STDERR "compiler warning: $_"; 90 | } 91 | } 92 | } 93 | else { 94 | print STDERR "WARNING: could not find file '$file'.\n"; 95 | } 96 | }else { 97 | print "ignoring '$file' - does not match prefix.\n"; 98 | } 99 | }else{ 100 | print "WARNING: could not understand : ", $_; 101 | } 102 | } 103 | } 104 | 105 | -------------------------------------------------------------------------------- /eclipse-tools/eclipseProjectMigrator: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | PROG_NAME=$0 4 | 5 | usage() 6 | { 7 | echo "usage: $PROG_NAME {