Lint line length, clarify index#about,, README badges

This commit is contained in:
PeridexisErrant 2015-09-30 19:37:38 +10:00
parent 0ae7c11b13
commit c04ac008b0
6 changed files with 38 additions and 31 deletions

View file

@ -1,9 +1,10 @@
@import url("alabaster.css"); /* make sure to sync this with the base theme's css filename */
/* make sure to sync this with the base theme's css filename */
@import url("alabaster.css");
.kbd {
/* Keybinding CSS from the DF wiki; applies to :kbd:`` directives.
* Use this directive for all keypresses, to make them look like keys.
*/
.kbd {
border: 1px solid #aaa;
border-radius: 0.2em;
-webkit-border-radius: 0.2em;

View file

@ -5,18 +5,18 @@ Any other automatic checks should be in this file too.
"""
import os
from os.path import *
import sys
text_extensions = ('rst', 'md', 'txt', 'html', 'css', 'js')
def lint():
def lint(path):
"""Run linters on all files, print problem files."""
print('Checking for tabs or trailing whitespace...')
failed = False
for root, _, files in os.walk('.'):
for root, _, files in os.walk(path):
for f in files:
fname = os.path.join(root, f)
fname = join(root, f)
if '_build' in fname or not any(
fname.endswith(ext) for ext in text_extensions):
continue
@ -28,12 +28,20 @@ def lint():
for line in fh.readlines()):
failed = True
print('ERROR: trailing whitespace in {}'.format(fname))
fh.seek(0)
for i, line in enumerate(fh.readlines()):
if len(line) > 81:
failed = True
print('ERROR: {}:{} - line too long'.format(
fname, i + 1))
if failed:
print('Use your text editor to convert tabs to spaces '
print('Use your text editor to convert tabs to spaces, wrap lines '
'or trim trailing whitespace with minimal effort.')
sys.exit(failed)
print('All files are OK')
if __name__ == '__main__':
lint()
# lint everything in the parent directory, wherever the script is run from.
p = relpath(join(dirname(__file__), '..'))
lint(p)

View file

@ -21,7 +21,8 @@ some of the better articles for a background understanding.
Although Dwarf Fortress is still in a work in progress, many features
have already been implemented...
-- `Tarn Adams (developer of *Dwarf Fortress*) <http://bay12games.com/dwarves/features.html>`_
-- `Tarn Adams (developer of *Dwarf Fortress*)
<http://bay12games.com/dwarves/features.html>`_
.. epigraph::
@ -55,7 +56,8 @@ some of the better articles for a background understanding.
established one might be home to established communities of potential
foes such as goblins.
-- `NewStatesman <http://www.newstatesman.com/killing-time/2014/07/way-down-hole-getting-grips-dwarf-fortress>`_
-- `NewStatesman <http://www.newstatesman.com/killing-time/2014/07/
way-down-hole-getting-grips-dwarf-fortress>`_
.. epigraph::
@ -74,5 +76,6 @@ some of the better articles for a background understanding.
appreciate art) to the climate and economic patterns of the
simulated world. ...
-- `The NY Times Magazine <http://www.nytimes.com/2011/07/24/magazine/the-brilliance-of-dwarf-fortress.html?_r=2&pagewanted=all>`_
-- `The NY Times Magazine <http://www.nytimes.com/2011/07/24/magazine/
the-brilliance-of-dwarf-fortress.html?_r=2&pagewanted=all>`_