summaryrefslogtreecommitdiff
path: root/tools/linter/main.rb
diff options
context:
space:
mode:
authordzwdz2023-06-20 20:38:18 +0200
committerdzwdz2023-06-20 20:38:18 +0200
commitfffd37f1680664bf055d8f5603ed1967718a6492 (patch)
treeeb10273e5ae3f46d2769888f1449ee89cf4257b6 /tools/linter/main.rb
parenta607ebac400857534582f0f50f0817ecc81812a6 (diff)
build: remove the old "linter"
It was a good idea, but it didn't even work. 0/10 Maybe I should replace it with semgrep someday. For the only current rule, I can split src/kernel/ into src/kernel/{amd64,generic}, and just don't have amd64 in generic's include path.
Diffstat (limited to 'tools/linter/main.rb')
-rwxr-xr-xtools/linter/main.rb28
1 files changed, 0 insertions, 28 deletions
diff --git a/tools/linter/main.rb b/tools/linter/main.rb
deleted file mode 100755
index 1198fd1..0000000
--- a/tools/linter/main.rb
+++ /dev/null
@@ -1,28 +0,0 @@
-#!/usr/bin/env ruby
-# must be run in the root directory of the repo
-# currently it only checks if code in src/kernel/ uses anything arch-dependent
-
-$return = 0
-
-def warn(msg)
- STDERR.puts "[LINTER] #{msg}"
- $return = 1
-end
-
-whitelist = ["arch/generic.h"]
-
-Dir["src/kernel/**.?"]
- .each do |path|
- File.read(path)
- .lines
- .map(&:strip) # strip whitespace
- .filter{|line| line[0] == '#'} # find preprocessor directives
- .map{|line| line[1..].strip} # get rid of the #, strip again
- .filter{|l| l.start_with? "include"} # find includes
- .map{|l| /([<"](.+)[">])/.match(l)[2]} # get the name of the included file
- .filter{|l| l.start_with? "arch/"} # find files in arch/
- .filter{|l| not whitelist.include? l} # filter out whitelisted headers
- .each{|inc| warn "#{path} includes #{inc}"}
- end
-
-exit $return