aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDundar Goc <gocdundar@gmail.com>2022-05-06 17:40:52 +0200
committerDundar Goc <gocdundar@gmail.com>2022-05-06 18:03:57 +0200
commitd0897243f6a6bb802fc9622486afd69eb65fa6d5 (patch)
treef1a7f276abea3255a33bff342123177873b2daca
parentd9ec57e16a13f66a4b17edd872786e2c67348752 (diff)
downloadrneovim-d0897243f6a6bb802fc9622486afd69eb65fa6d5.tar.gz
rneovim-d0897243f6a6bb802fc9622486afd69eb65fa6d5.tar.bz2
rneovim-d0897243f6a6bb802fc9622486afd69eb65fa6d5.zip
build(clint): remove "function size is too large" warning
This warning is essentially only triggered for ported vim functions. It's unlikely that we'll refactor vim functions solely based on their size since it'd mean we'd greatly deviate from vim, which is a high cost when it comes to importing the vim patches. Thus, this warning only serves as an annoyance and should be removed.
-rwxr-xr-xsrc/clint.py29
-rw-r--r--src/nvim/buffer.c2
-rw-r--r--src/nvim/change.c2
-rw-r--r--src/nvim/eval/userfunc.c2
-rw-r--r--src/nvim/ex_cmds.c2
-rw-r--r--src/nvim/ex_docmd.c2
-rw-r--r--src/nvim/ops.c2
-rw-r--r--src/nvim/option.c2
-rw-r--r--src/nvim/screen.c2
-rw-r--r--src/nvim/viml/parser/expressions.c2
10 files changed, 9 insertions, 38 deletions
diff --git a/src/clint.py b/src/clint.py
index cb91d9bd68..befb10c9c7 100755
--- a/src/clint.py
+++ b/src/clint.py
@@ -44,7 +44,6 @@ same line, but it is far from perfect (in either direction).
import codecs
import copy
import getopt
-import math # for log
import os
import re
import sre_compile
@@ -183,7 +182,6 @@ _ERROR_CATEGORIES = [
'readability/alt_tokens',
'readability/bool',
'readability/braces',
- 'readability/fn_size',
'readability/multiline_comment',
'readability/multiline_string',
'readability/nul',
@@ -642,32 +640,6 @@ class _FunctionState:
if self.in_a_function:
self.lines_in_function += 1
- def Check(self, error, filename, linenum):
- """Report if too many lines in function body.
-
- Args:
- error: The function to call with any errors found.
- filename: The name of the current file.
- linenum: The number of the line to check.
- """
- if Match(r'T(EST|est)', self.current_function):
- base_trigger = self._TEST_TRIGGER
- else:
- base_trigger = self._NORMAL_TRIGGER
- trigger = base_trigger * 2**_VerboseLevel()
-
- if self.lines_in_function > trigger:
- error_level = int(
- math.log(self.lines_in_function / base_trigger, 2))
- # 50 => 0, 100 => 1, 200 => 2, 400 => 3, 800 => 4, 1600 => 5, ...
- if error_level > 5:
- error_level = 5
- error(filename, linenum, 'readability/fn_size', error_level,
- 'Small and focused functions are preferred:'
- ' %s has %d non-comment lines'
- ' (error triggered by exceeding %d lines).' % (
- self.current_function, self.lines_in_function, trigger))
-
def End(self):
"""Stop analyzing function body."""
self.in_a_function = False
@@ -1887,7 +1859,6 @@ def CheckForFunctionLengths(filename, clean_lines, linenum,
error(filename, linenum, 'readability/fn_size', 5,
'Lint failed to find start of function body.')
elif Match(r'^\}\s*$', line): # function end
- function_state.Check(error, filename, linenum)
function_state.End()
elif not Match(r'^\s*$', line):
function_state.Count() # Count non-blank/non-comment lines.
diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c
index 1ae1811772..9759bdb46e 100644
--- a/src/nvim/buffer.c
+++ b/src/nvim/buffer.c
@@ -4544,7 +4544,7 @@ int build_stl_str_hl(win_T *wp, char_u *out, size_t outlen, char_u *fmt, int use
}
return width;
-} // NOLINT(readability/fn_size)
+}
/// Get relative cursor position in window into "buf[buflen]", in the form 99%,
/// using "Top", "Bot" or "All" when appropriate.
diff --git a/src/nvim/change.c b/src/nvim/change.c
index 2d5ece8880..df7a7a00a9 100644
--- a/src/nvim/change.c
+++ b/src/nvim/change.c
@@ -1802,7 +1802,7 @@ theend:
xfree(next_line);
xfree(allocated);
return retval;
-} // NOLINT(readability/fn_size)
+}
/// Delete from cursor to end of line.
/// Caller must have prepared for undo.
diff --git a/src/nvim/eval/userfunc.c b/src/nvim/eval/userfunc.c
index 2dd022630a..c518b11a65 100644
--- a/src/nvim/eval/userfunc.c
+++ b/src/nvim/eval/userfunc.c
@@ -2586,7 +2586,7 @@ ret_free:
if (show_block) {
ui_ext_cmdline_block_leave();
}
-} // NOLINT(readability/fn_size)
+}
/// @return 5 if "p" starts with "<SID>" or "<SNR>" (ignoring case).
/// 2 if "p" starts with "s:".
diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c
index abadd21a1a..5b831a21c0 100644
--- a/src/nvim/ex_cmds.c
+++ b/src/nvim/ex_cmds.c
@@ -4467,7 +4467,7 @@ skip:
return preview_buf;
#undef ADJUST_SUB_FIRSTLNUM
#undef PUSH_PREVIEW_LINES
-} // NOLINT(readability/fn_size)
+}
/// Give message for number of substitutions.
/// Can also be used after a ":global" command.
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c
index 116264b4c1..d2b833305b 100644
--- a/src/nvim/ex_docmd.c
+++ b/src/nvim/ex_docmd.c
@@ -2219,7 +2219,7 @@ doend:
--ex_nesting_level;
return ea.nextcmd;
-} // NOLINT(readability/fn_size)
+}
static char ex_error_buf[MSG_BUF_LEN];
diff --git a/src/nvim/ops.c b/src/nvim/ops.c
index 7e5840e444..f7a3201568 100644
--- a/src/nvim/ops.c
+++ b/src/nvim/ops.c
@@ -3761,7 +3761,7 @@ end:
// If the cursor is past the end of the line put it at the end.
adjust_cursor_eol();
-} // NOLINT(readability/fn_size)
+}
/*
* When the cursor is on the NUL past the end of the line and it should not be
diff --git a/src/nvim/option.c b/src/nvim/option.c
index 16c4abfa2a..9be55b91b4 100644
--- a/src/nvim/option.c
+++ b/src/nvim/option.c
@@ -3382,7 +3382,7 @@ ambw_end:
check_redraw(options[opt_idx].flags);
return errmsg;
-} // NOLINT(readability/fn_size)
+}
/// Simple int comparison function for use with qsort()
static int int_cmp(const void *a, const void *b)
diff --git a/src/nvim/screen.c b/src/nvim/screen.c
index 384f2995ee..910cf335ca 100644
--- a/src/nvim/screen.c
+++ b/src/nvim/screen.c
@@ -1748,7 +1748,7 @@ static void win_update(win_T *wp, DecorProviders *providers)
if (!got_int) {
got_int = save_got_int;
}
-} // NOLINT(readability/fn_size)
+}
/// Returns width of the signcolumn that should be used for the whole window
///
diff --git a/src/nvim/viml/parser/expressions.c b/src/nvim/viml/parser/expressions.c
index 01fc282891..2693093f4a 100644
--- a/src/nvim/viml/parser/expressions.c
+++ b/src/nvim/viml/parser/expressions.c
@@ -3067,7 +3067,7 @@ viml_pexpr_parse_end:
}
kvi_destroy(ast_stack);
return ast;
-} // NOLINT(readability/fn_size)
+}
#undef NEW_NODE
#undef HL