From dd96cfe74c6486befc8bb1159c5f35b0c94ca4b0 Mon Sep 17 00:00:00 2001 From: Angelos Chalaris Date: Sat, 15 Sep 2018 15:03:39 +0300 Subject: [PATCH] Duplication and unnecessary dependency cleanup --- scripts/analyze.js | 1 - scripts/localize.js | 1 - scripts/tag.js | 4 ---- scripts/web.js | 1 - snippet_data/snippetAnalytics.json | 8 ++++---- snippet_data/snippetArchiveAnalytics.json | 16 ++++++++-------- 6 files changed, 12 insertions(+), 19 deletions(-) diff --git a/scripts/analyze.js b/scripts/analyze.js index b9375a479..1997fc925 100644 --- a/scripts/analyze.js +++ b/scripts/analyze.js @@ -7,7 +7,6 @@ const fs = require('fs-extra'); const path = require('path'); const chalk = require('chalk'); const prism = require('prismjs'); -const util = require('./util'); let snippetsData = require('../snippet_data/snippets.json'); let snippetsArchiveData = require('../snippet_data/snippetsArchive.json'); // Paths diff --git a/scripts/localize.js b/scripts/localize.js index 261a55d15..88e270d6e 100644 --- a/scripts/localize.js +++ b/scripts/localize.js @@ -6,7 +6,6 @@ // Load modules const fs = require('fs-extra'); const path = require('path'); -const chalk = require('chalk'); const util = require('./util'); const LOCALE_PATH = 'locale'; diff --git a/scripts/tag.js b/scripts/tag.js index bf8d76178..8b0142c0a 100644 --- a/scripts/tag.js +++ b/scripts/tag.js @@ -4,7 +4,6 @@ */ // Load modules const fs = require('fs-extra'), - path = require('path'), chalk = require('chalk'); const util = require('./util'); if (util.isTravisCI() && /^Travis build: \d+/g.test(process.env['TRAVIS_COMMIT_MESSAGE'])) { @@ -19,9 +18,6 @@ let snippets = {}, tagDbData = {}, missingTags = 0, tagDbStats = {}; -// Load helper functions (these are from existing snippets in 30 seconds of code!) -const objectFromPairs = arr => arr.reduce((a, v) => ((a[v[0]] = v[1]), a), {}); -const countOccurrences = (arr, value) => arr.reduce((a, v) => (v === value ? a + 1 : a + 0), 0); // Start the timer of the script console.time('Tagger'); // Synchronously read all snippets and sort them as necessary (case-insensitive) diff --git a/scripts/web.js b/scripts/web.js index a13e93e54..4c1a595a1 100644 --- a/scripts/web.js +++ b/scripts/web.js @@ -4,7 +4,6 @@ */ // Load modules const fs = require('fs-extra'), - https = require('https'), path = require('path'), chalk = require('chalk'), md = require('markdown-it')(), diff --git a/snippet_data/snippetAnalytics.json b/snippet_data/snippetAnalytics.json index 60dec5070..3546dbd64 100644 --- a/snippet_data/snippetAnalytics.json +++ b/snippet_data/snippetAnalytics.json @@ -2794,15 +2794,15 @@ "id": "objectFromPairs", "type": "snippetAnalysis", "attributes": { - "codeLength": 79, - "tokenCount": 44, + "codeLength": 86, + "tokenCount": 43, "functionCount": 1, "operatorCount": 4, "keywordCount": 1, "distinctFunctionCount": 1 }, "meta": { - "hash": "c19c3608e7a51b5b67046bc49b59e3e70e1161d0c5df0d77c8904a8e2bfa1c71" + "hash": "5dac82c5ca1e0d36ddc13bd1d3e643676c271f86eebf8aa4fb1afb382e07e771" } }, { @@ -3592,7 +3592,7 @@ "codeLength": 92, "tokenCount": 31, "functionCount": 1, - "operatorCount": 3, + "operatorCount": 4, "keywordCount": 1, "distinctFunctionCount": 1 }, diff --git a/snippet_data/snippetArchiveAnalytics.json b/snippet_data/snippetArchiveAnalytics.json index 4e76a1239..cdd182da3 100644 --- a/snippet_data/snippetArchiveAnalytics.json +++ b/snippet_data/snippetArchiveAnalytics.json @@ -169,15 +169,15 @@ "id": "isSimilar", "type": "snippetAnalysis", "attributes": { - "codeLength": 225, - "tokenCount": 3, - "functionCount": 0, - "operatorCount": 0, - "keywordCount": 0, - "distinctFunctionCount": 0 + "codeLength": 214, + "tokenCount": 78, + "functionCount": 3, + "operatorCount": 10, + "keywordCount": 1, + "distinctFunctionCount": 2 }, "meta": { - "hash": "b821ad7f7e34c6905f88e1618b629506e265e1a3459288ab7d7b3501b2476dd2" + "hash": "669cc6d3a6f96a65b6e4bf678bb0b95cde711baaabe206db66d69599f6e93a51" } }, { @@ -237,7 +237,7 @@ "distinctFunctionCount": 3 }, "meta": { - "hash": "878970d0bdefe60f7f61db64b85bbb36b6869e2875a2c278fb269b8cff3b42b4" + "hash": "1f1d7def5d8b149626518181acb9f0e7fd0b44b31e5b42ce1e2f53e07eb01bc0" } }, {