提交 8b7c0be0 编写于 作者: V Vidar Holen

gcc output mode now uses a tab width of 1

上级 473bb666
......@@ -131,7 +131,8 @@ forGcc options files = do
return $ and files
where
process file = do
comments <- commentsFor file
contents <- readContents file
let comments = makeNonVirtual (shellCheck contents) contents
mapM_ (putStrLn . format file) comments
return $ null comments
......@@ -191,6 +192,18 @@ forCheckstyle options files = do
commentsFor file = liftM shellCheck $ readContents file
readContents file = if file == "-" then getContents else readFile file
-- Realign comments from a tabstop of 8 to 1
makeNonVirtual comments contents =
map fix comments
where
ls = lines contents
fix c = c { scColumn = real (ls !! (scLine c - 1)) 0 0 (scColumn c) }
real _ r v target | target <= v = r
real [] r v _ = r -- should never happen
real ('\t':rest) r v target =
real rest (r+1) (v + 8 - (v `mod` 8)) target
real (_:rest) r v target = real rest (r+1) (v+1) target
getOption [] _ def = def
getOption ((Flag var val):_) name _ | name == var = val
getOption (_:rest) flag def = getOption rest flag def
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册