Simple lint for Markdown

With Markdownlint you can quickly check your own *.md files. You can use that tool for automation in your build environment.

Installation

# install via gem
$ sudo gem install mdl

# install via gem (Mac OS 10.11 - El Capitan)
$ sudo gem install -n /usr/local/bin mdl

# check version
$ mdl --version

Usage

The use of Markdownlint is very easy.

# scan a markdown file
$ mdl path/to/file.md

# scan a folder with different markdown files
$ mdl path/to/folder

Test XML command line with xmllint

In most Linux and BSD, xmllint is delivered or very easy to install. Xmllint can parse and validate one or more XML files with output as reports. A version for Windows is available, too!

The tiny example XML file:

<?xml version="1.0" encoding="UTF-8"?>
<company>
	<branch lang="de-DE">
		<team id="011">
			<name status="on">Develop</name>
			<size>8</size>
		</team>
	</branch>
	<branch lang="en-US">
		<team id="021">
			<name status="off">Sales</name>
			<size>5</size>
		</team>
		<team id="022">
			<name status="on">QA</name>
			<size>2</size>
		</team>
	</branch>
	<branch lang="de-CH">
		<team id="031">
			<name status="on">Develop</name>
			<size>5</size>
		</team>
		<team id="032">
			<name status="off">Consultant</name>
			<size>3</size>
		</team>
	</branch>
</company>

Usage Examples:

# simple validation
$ xmllint --valid example.xml

# validation but without result tree
$ xmllint --valid --noout example.xml

# validation agains a specific DTD schema
$ xmllint --noout --dtdvalid <URL> example.xml

# again RelaxNG schema
$ xmllint --relaxng <schema> example.xml

# again WXS schema
$ xmllint --schema <schema> example.xml

# again schematron
$ xmllint --schematron <schema> example.xml

Query with xmllint

$ xmllint --shell example.xml

# with cat
/ > cat //name
 -------
<name status="on">Develop</name>
 -------
<name status="off">Sales</name>
 -------
<name status="on">QA</name>
 -------
<name status="on">Develop</name>
 -------
<name status="off">Consultant</name>

# with cat and xpath 
/ > cat //*[contains(*,"Consultant")] 
 -------
<team id="032">
	<name status="off">Consultant</name>
	<size>3</size>
</team>

# with grep
/ > grep QA
/company/branch[2]/team[2]/name : ta-        2 QA

# exit
/ > exit

XPath with xmllint

# by root element
$ xmllint --xpath //company example.xml

# by child elements
$ xmllint --xpath //name example.xml 

# by specific child element
$ xmllint --xpath //branch[3] example.xml

# by last child element
$ xmllint --xpath '/company/branch[last()]' example.xml

# path expression
$ xmllint --xpath 'child::*/child::*/team' example.xml

# by attribute
$ xmllint --xpath '//branch[@lang="de-CH"]' example.xml

CSSLint with Grunt on Debian

This tutorial gives an tiny insight into CSSLint with Grunt on Debian. After that you should be able, to implement more Grunt tasks for your project.

Installation

As root or sudo user install needed packages!

# update your system
$ apt-get update && apt-get upgrade

# install nodejs and npm
$ apt-get install -y nodejs-legacy npm

# install grunt-cli (global)
$ npm install -g grunt-cli

Check the installation of all needed tools.

# show different versions
$ nodejs --version
$ npm --version
$ grunt --version

Create a new project

As “normal” user create a new project and install the needed plugin.

# create new folder
$ mkdir TestProject

# change directory
$ cd TestProject/

# interactively create a package.json file
$ npm init

# install the csslint plugin
$ npm install grunt-contrib-csslint --save-dev

If no problems occurred, the package.json file should look like:

{
  "name": "TestProject",
  "version": "0.0.1",
  "description": "my example project",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "lupin3000",
  "license": "ISC",
  "devDependencies": {
    "grunt": "^0.4.5", "grunt-contrib-csslint": "^0.4.0"
  }
}

Create a css folder and a css file with some mistakes like:

$ mkdir css
$ vim css/example.css

The example.css file contains some issues!

html, body {
  margin: 0;
  padding: 0 
  borde: 0;
}

In the last step we create the Gruntfile.js

# create Gruntfile.js
$ vim Gruntfile.js
module.exports = function(grunt) {
  grunt.initConfig({
    csslint: {
      // define the files to lint
      files: ['css/*.css'],
      strict: {
        options: {
          "import": 2
        }
      }
    }
  });
  grunt.loadNpmTasks("grunt-contrib-csslint");
};

Thats all, now run just the command and see the results.

# run csslinter
$ grunt csslint

Integrate pylint in PyCharm

This tutorial shows, how to add pylint into PyCharm.

Preparation

# install pylint via pip
$ sudo pip install pylint

That was the easy way to install pylint…

Steps

Open “Settings > Tools > External Tools” and press the “+” button.

pycharm external tools

Insert values

Inserts good values on name, description and select your favorite group. Enable more or less all checkboxes. Down the “Tool settings” insert program “pylint”, your specific parameters and working directory.

pycharm pylint

After press “OK” pylint integration is ready.

Extended

To be a little more flexible, you can use PyCharm macros. As an example use the value “$FilePath$” for Working directory and “$Promt$” for Parameters. This allows the use in other projects, too.

pycharm macros