Skip to content

Commit 8334ff4

Browse files
committed
adding validattor
1 parent ed2987b commit 8334ff4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

92 files changed

+18653
-0
lines changed

.travis.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
language: node_js
2+
3+
script: cd scripts \
4+
&& npm run validate
5+
6+
notifications:
7+
email: false
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

scripts/formatter.js

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/**
2+
* The All Algorithms C++ Formatter
3+
*
4+
* Author: Carlos Abraham Hernandez
5+
* https://abranhe.com (abraham@abranhe.com)
6+
*/
7+
'use strict';
8+
9+
const glob = require('glob');
10+
const path = require('path');
11+
const decamelize = require('decamelize');
12+
const shell = require('child_process').execSync;
13+
14+
const getFiles = (src, callback) => {
15+
glob(src + '/**', callback);
16+
};
17+
18+
getFiles('../', (err, res) => {
19+
if (err) {
20+
console.log('Error', err);
21+
} else {
22+
res.map((file) => {
23+
// Accept only valid C++ Files (.cpp,.hpp,.h)
24+
if (path.extname(file) !== '.cpp' && path.extname(file) !== '.hpp' && path.extname(file) !== '.h') {
25+
return;
26+
}
27+
28+
// Only avilable for Linux/Macos
29+
// https://stackoverflow.com/a/41030518/7602110
30+
// Can be replaced in the future
31+
shell(`mv ${file} ${decamelize(file)}`);
32+
33+
// Replace for convention .h for .hpp
34+
if (path.extname(file) === '.h') {
35+
shell(`mv ${file} ${file.replace(/\.[^\.]+$/, '.hpp')}`);
36+
}
37+
});
38+
}
39+
});

scripts/node_modules/.yarn-integrity

Lines changed: 29 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)