Skip to content

Commit

Permalink
Adjust CI Linter Check Parameters (#99)
Browse files Browse the repository at this point in the history
- Change line limit to 120 chars
- Add linting of .cpp and .h files
- Fix minor style issues from the linter adjustment

Commit log:

* Enfore 120 line length in linter

* Change default linelen

* Fix some line length changes

* Style fix

* Add lint for cpp .h files
  • Loading branch information
koolzz authored Apr 14, 2019
1 parent 5a78515 commit 552867d
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion CPPLINT.cfg
Original file line number Diff line number Diff line change
@@ -1 +1 @@
linelength=100
linelength=120
2 changes: 1 addition & 1 deletion ci/helper-functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ check_exit_code(){

# runs the linter
run_linter() {
for fn in $(git ls-files *.c | grep -v "cJSON" | grep -v "ndpi"); do
for fn in $(git ls-files *.c *.cpp *.h | grep -v "cJSON" | grep -v "ndpi"); do
python style/gwclint.py --verbose=5 $fn 2>&1 | grep -v "Done" | grep -v "Total errors found: 0" >> $1
done
}
3 changes: 2 additions & 1 deletion examples/speed_tester/speed_tester.c
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,8 @@ run_advanced_rings(struct onvm_nf_info *nf_info) {
printf("Time to live exceeded, shutting down\n");
keep_running = 0;
}
if (nf_info->pkt_limit && unlikely(nf->stats.rx >= (uint64_t) nf_info->pkt_limit * PKT_TTL_MULTIPLIER)) {
if (nf_info->pkt_limit && unlikely(nf->stats.rx >=
(uint64_t) nf_info->pkt_limit * PKT_TTL_MULTIPLIER)) {
printf("Packet limit exceeded, shutting down\n");
keep_running = 0;
}
Expand Down
3 changes: 2 additions & 1 deletion onvm/onvm_mgr/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ master_thread_main(void) {
if (stats_destination != ONVM_STATS_NONE)
onvm_stats_display_all(sleeptime, verbosity_level);

if (time_to_live && unlikely((rte_get_tsc_cycles() - start_time) * TIME_TTL_MULTIPLIER / rte_get_timer_hz() >= time_to_live)) {
if (time_to_live && unlikely((rte_get_tsc_cycles() - start_time) * TIME_TTL_MULTIPLIER /
rte_get_timer_hz() >= time_to_live)) {
printf("Time to live exceeded, shutting down\n");
main_keep_running = 0;
}
Expand Down
6 changes: 3 additions & 3 deletions style/gwclint.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
linelength=digits
This is the allowed line length for the project. The default value is
80 characters.
120 characters.
Examples:
--linelength=120
Expand Down Expand Up @@ -496,7 +496,7 @@

# The allowed line length of files.
# This is set by --linelength flag.
_line_length = 80
_line_length = 120

# The allowed extensions for file names
# This is set by --extensions flag.
Expand Down Expand Up @@ -4455,7 +4455,7 @@ def CheckStyle(filename, clean_lines, linenum, file_extension, nesting_state,
'Lines should very rarely be longer than %i characters' %
extended_length)
elif line_width > _line_length:
error(filename, linenum, 'whitespace/line_length', 2,
error(filename, linenum, 'whitespace/line_length', 5,
'Lines should be <= %i characters long' % _line_length)

if (cleansed_line.count(';') > 1 and
Expand Down

0 comments on commit 552867d

Please sign in to comment.