Skip to content

Commit

Permalink
Merge pull request canada-ca#4 from nschonni/temaplate-files
Browse files Browse the repository at this point in the history
chore: Copy linting setup from template repo
  • Loading branch information
ptd-tbs committed Dec 10, 2019
2 parents fa77787 + 03d3a3d commit e9cbaa2
Show file tree
Hide file tree
Showing 9 changed files with 1,038 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
@@ -0,0 +1,2 @@
# Set the default behavior, in case people don't have core.autocrlf set.
* text=auto
72 changes: 72 additions & 0 deletions .gitignore
@@ -0,0 +1,72 @@
.DS_Store

# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env

# next.js build output
.next

# local bundler files
.bundle
Gemfile.lock
vendor

# local Jekyll files
_site
.jekyll-metadata
4 changes: 4 additions & 0 deletions .markdown-link-check.json
@@ -0,0 +1,4 @@
{
"ignorePatterns": [
]
}
5 changes: 5 additions & 0 deletions .markdownlint.json
@@ -0,0 +1,5 @@
{
"default": true,
"MD013": false,
"MD041": false
}
4 changes: 4 additions & 0 deletions .travis.yml
@@ -0,0 +1,4 @@
language: node_js

node_js:
- "node"
6 changes: 3 additions & 3 deletions README.md
Expand Up @@ -4,9 +4,9 @@ This project will host the minimum guardrails as part of the GC Cloud Operationa

## Purpose

The purpose of the guardrails is to ensure that departments and agencies are implementing a preliminary baseline set of controls within their cloud-based environments. These minimum guardrails are to be implemented within the GC-specified initial period (e.g. 30 days) upon receipt of an enrollment under the GC Cloud Services Framework Agreement.
The purpose of the guardrails is to ensure that departments and agencies are implementing a preliminary baseline set of controls within their cloud-based environments. These minimum guardrails are to be implemented within the GC-specified initial period (e.g. 30 days) upon receipt of an enrollment under the GC Cloud Services Framework Agreement.

Departments
Departments

## Summary - Initial 30 Days

Expand Down Expand Up @@ -48,6 +48,7 @@ The Canada wordmark and related graphics associated with this distribution are p

______________________

<!-- markdownlint-disable MD024 MD025 -->
# GC Cloud Guardrails

TBD
Expand All @@ -61,4 +62,3 @@ Voir [CONTRIBUTING.md](CONTRIBUTING.md)
Sauf indication contraire, le code source de ce projet est protégé par le droit d'auteur de la Couronne du gouvernement du Canada et distribué sous la [licence MIT](LICENSE).

Le mot-symbole « Canada » et les éléments graphiques connexes liés à cette distribution sont protégés en vertu des lois portant sur les marques de commerce et le droit d'auteur. Aucune autorisation n'est accordée pour leur utilisation à l'extérieur des paramètres du programme de coordination de l'image de marque du gouvernement du Canada. Pour obtenir davantage de renseignements à ce sujet, veuillez consulter les [Exigences pour l'image de marque](https://www.canada.ca/fr/secretariat-conseil-tresor/sujets/communications-gouvernementales/exigences-image-marque.html).

45 changes: 45 additions & 0 deletions link-check.js
@@ -0,0 +1,45 @@
#!/usr/bin/env node

'use strict';

var markdownLinkCheck = require('markdown-link-check');
var fs = require("fs");
var glob = require("glob");
var path = require("path");
var chalk = require("chalk");


var files = glob.sync("**/*.md", {ignore: ["node_modules/**/*.md"]})

var config = JSON.parse(fs.readFileSync(".markdown-link-check.json"));
config.timeout = '30s'

var opts = JSON.parse(fs.readFileSync(".markdown-link-check.json"));

files.forEach(function(file) {
var markdown = fs.readFileSync(file).toString();
let opts = Object.assign({}, config);

opts.baseUrl = path.dirname(path.resolve(file)) + '/';

markdownLinkCheck(markdown, opts, function (err, results) {
if (err) {
console.error('Error', err);
return;
}

console.log(chalk.green("Reading: " + file));

results.forEach(function (result) {
if(result.status === "dead") {
if (result.statusCode == 500) {
console.log(chalk.yellow("Server error on target: " + result.link));
}
else {
process.exitCode = 1
console.log(chalk.red("Dead: " + result.link));
}
}
});
});
});

0 comments on commit e9cbaa2

Please sign in to comment.