Permalink
Browse files

Don't check line-length in .csv files. Fix limits for 'other' files.

  • Loading branch information...
1 parent cf73c56 commit f269f994286b70feae6e0ef7e9995e0b4b490402 @timhunt timhunt committed Apr 4, 2012
Showing with 9 additions and 7 deletions.
  1. +2 −2 lang/en/local_codechecker.php
  2. +7 −5 locallib.php
@@ -31,8 +31,8 @@
$string['error_find'] = 'Folder search failed';
$string['other_eol'] = 'Whitespace at end of line';
$string['other_tab'] = 'Tab character not permitted';
-$string['other_toolong'] = 'Line longer than maximum 140 characters';
-$string['other_ratherlong'] = 'Line longer than recommended 100 characters';
+$string['other_toolong'] = 'Line longer than maximum 180 characters';
+$string['other_ratherlong'] = 'Line longer than recommended 132 characters';
$string['other_crlf'] = 'Windows (CRLF) line ending instead of just LF (reporting only first occurrence)';
$string['other_missinglf'] = 'Missing LF at end of file (use exactly one)';
$string['other_extralfs'] = 'Extra blank line(s) at end of file (use exactly one)';
View
@@ -209,7 +209,8 @@ function local_codechecker_check_other_file($file, &$problems) {
// Certain files are permitted lines of any length because they are
// auto-generated
- $allowanylength = in_array(basename($file), array('install.xml'));
+ $allowanylength = in_array(basename($file), array('install.xml')) ||
+ substr($file, -4, 4) === '.csv';
$lines = file($file);
$index = 0;
@@ -240,11 +241,12 @@ function local_codechecker_check_other_file($file, &$problems) {
if (preg_match('~\t~', $l)) {
local_codechecker_add_problem($problems, $file, $index, 'tab');
}
- if (strlen($l) > 140 && !$allowanylength) {
- // Line length > 140
+
+ if (strlen($l) > 180 && !$allowanylength) {
+ // Line length > 180
local_codechecker_add_problem($problems, $file, $index, 'toolong');
- } else if (strlen($l) > 100 && !$allowanylength) {
- // Line length > 100
+ } else if (strlen($l) > 132 && !$allowanylength) {
+ // Line length > 132
local_codechecker_add_problem($problems, $file, $index, 'ratherlong', true);
}
}

0 comments on commit f269f99

Please sign in to comment.