-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Eduardo Feo
committed
Aug 19, 2023
0 parents
commit 0b7891e
Showing
4,992 changed files
with
333,694 additions
and
0 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Save as .codeclimate.yml (note leading .) in project root directory | ||
version: "2" | ||
languages: | ||
Ruby: false | ||
JavaScript: true | ||
PHP: false | ||
checks: | ||
file-lines: | ||
config: | ||
threshold: 500 | ||
method-lines: | ||
config: | ||
threshold: 75 | ||
method-complexity: | ||
config: | ||
threshold: 10 | ||
similar-code: | ||
config: | ||
threshold: 65 | ||
plugins: | ||
duplication: | ||
enabled: true | ||
config: | ||
languages: | ||
javascript: | ||
mass_threshold: 110 | ||
count_threshold: 3 | ||
exclude_paths: | ||
- "public/vendor/*" | ||
- "test/*" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
root = true | ||
|
||
[{*.js, *.css, *.tpl, *.json, *.ts}] | ||
indent_style = space | ||
indent_size = 4 | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
node_modules/ | ||
*.sublime-project | ||
*.sublime-workspace | ||
.project | ||
.vagrant | ||
.DS_Store | ||
logs/ | ||
/public/templates | ||
/public/uploads | ||
/public/vendor | ||
/public/src/modules/string.js | ||
.idea/ | ||
.vscode/ | ||
*.ipr | ||
*.iws | ||
/coverage | ||
/build | ||
.eslintrc | ||
test/files | ||
*.min.js | ||
|
||
/public/src/app.js | ||
/public/src/client.js | ||
/public/src/admin/admin.js | ||
/public/src/modules/translator.common.js | ||
/public/src/modules/pictureCropper.js | ||
/public/src/modules/ace-editor.js | ||
/public/src/client/account/header.js | ||
/public/src/client/test.js | ||
themes/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
|
||
const fs = require('fs'); | ||
const path = require('path'); | ||
|
||
// Directories that contain TypeScript files of note | ||
const tsDirs = [ | ||
"public/src", | ||
"src", | ||
"test", | ||
]; | ||
|
||
// Helper walk function to check all directories | ||
function walk(dir) { | ||
var results = []; | ||
var list = fs.readdirSync(dir); | ||
list.forEach(function(file) { | ||
file = dir + '/' + file; | ||
var stat = fs.statSync(file); | ||
if (stat && stat.isDirectory()) { | ||
results = results.concat(walk(file)); | ||
} else { | ||
results.push(file); | ||
} | ||
}); | ||
return results; | ||
} | ||
|
||
// Find all JS files that were compiled from TS | ||
function find_compiled_js() { | ||
let jsFilesList = []; | ||
|
||
tsDirs.forEach(tsDir => { | ||
let filesList = walk(tsDir); | ||
const tsFilesList = filesList.filter((file) => path.extname(file).toLowerCase() === '.ts'); | ||
jsFilesList = jsFilesList.concat(filesList.filter( | ||
(file) => path.extname(file).toLowerCase() === '.js' && | ||
tsFilesList.find(tsFile => tsFile === (file.replace(/\.[^/.]+$/, "") + ".ts")) !== undefined)); | ||
}); | ||
|
||
if (jsFilesList.length == 0) return ""; | ||
return jsFilesList; | ||
} | ||
|
||
module.exports = { | ||
extends: ["nodebb"], | ||
root: true, | ||
ignorePatterns: find_compiled_js(), | ||
rules: { | ||
"indent": ["error", 4] | ||
}, | ||
overrides: [ | ||
{ | ||
files: ["**/*.ts", "**/*.tsx"], | ||
extends: [ | ||
"plugin:@typescript-eslint/recommended", | ||
"plugin:@typescript-eslint/recommended-requiring-type-checking" | ||
], | ||
parser: "@typescript-eslint/parser", | ||
plugins: ["@typescript-eslint"], | ||
parserOptions: { | ||
ecmaFeatures: { jsx: true }, | ||
project: "./tsconfig.json" | ||
}, | ||
rules: { | ||
"no-use-before-define": "off", | ||
"@typescript-eslint/no-use-before-define": "error", | ||
} | ||
} | ||
] | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# These files are text and should be normalized (convert crlf => lf) | ||
*.json text | ||
*.css text | ||
*.less text | ||
*.tpl text | ||
*.html text | ||
*.js text | ||
*.md text | ||
|
||
# Images should be treated as binary | ||
# (binary is a macro for -text -diff) | ||
*.png binary | ||
*.jpg binary |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
name: Homework 1 Check | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
hw1: | ||
permissions: | ||
checks: write | ||
contents: read | ||
name: Homework 1 | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest] | ||
node: [16] | ||
runs-on: ${{ matrix.os }} | ||
env: | ||
TEST_ENV: ${{ matrix.test_env || 'production' }} | ||
|
||
services: | ||
mongo: | ||
image: 'mongo:3.7' | ||
ports: | ||
# Maps port 27017 on service container to the host | ||
- 27017:27017 | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- run: cp install/package.json package.json | ||
|
||
- name: Install Node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node }} | ||
|
||
- name: NPM Install | ||
uses: bahmutov/npm-install@v1 | ||
with: | ||
useLockFile: false | ||
|
||
- name: Setup on MongoDB | ||
env: | ||
SETUP: >- | ||
{ | ||
"url": "http://127.0.0.1:4567", | ||
"secret": "abcdef", | ||
"admin:username": "admin", | ||
"admin:email": "[email protected]", | ||
"admin:password": "hAN3Eg8W", | ||
"admin:password:confirm": "hAN3Eg8W", | ||
"database": "mongo", | ||
"mongo:host": "127.0.0.1", | ||
"mongo:port": 27017, | ||
"mongo:username": "", | ||
"mongo:password": "", | ||
"mongo:database": "nodebb" | ||
} | ||
CI: >- | ||
{ | ||
"host": "127.0.0.1", | ||
"port": 27017, | ||
"database": "ci_test" | ||
} | ||
run: | | ||
node app --setup="${SETUP}" --ci="${CI}" | ||
- name: Get specific changed files | ||
id: changed-files-specific | ||
uses: tj-actions/changed-files@v24 | ||
with: | ||
files: | | ||
./**/*.js | ||
./**/*.ts | ||
- name: Check that HW1 specifications are met | ||
run: | | ||
IFS=' ' read -r -a addedarray <<< "${{ steps.changed-files-specific.outputs.added_files }}" | ||
IFS=' ' read -r -a modifiedarray <<< "${{ steps.changed-files-specific.outputs.modified_files }}" | ||
PASS="false" | ||
for addedfile in "${addedarray[@]}" | ||
do | ||
IFS='. ' read -r -a addfilesplit <<< $addedfile | ||
ADDFILENAME="${addfilesplit[0]}" | ||
ADDFILEEXT="${addfilesplit[1]}" | ||
if [ "$ADDFILEEXT" == "ts" ] | ||
then | ||
for modifiedfile in "${modifiedarray[@]}" | ||
do | ||
IFS='. ' read -r -a modfilesplit <<< $modifiedfile | ||
MODFILENAME="${modfilesplit[0]}" | ||
MODFILEEXT="${modfilesplit[1]}" | ||
if [ "$MODFILEEXT" == "js" ] && [ "$ADDFILENAME" == "$MODFILENAME" ] | ||
then | ||
echo "Found suitable file!" | ||
PASS="true" | ||
fi | ||
done | ||
fi | ||
done | ||
if [ "$PASS" != "true" ] | ||
then | ||
echo "No suitable files found that match the requirements of HW1. Please check that you have translated a JS file into TypeScript and regenerated the JavaScript file using % npx tsc" | ||
echo "Files added (should see your xx.ts file): ${{ steps.changed-files-specific.outputs.added_files }}" | ||
echo "Files modified (should see your xx.js file): ${{ steps.changed-files-specific.outputs.modified_files }}" | ||
exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
name: Lint | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
lint: | ||
permissions: | ||
checks: write # for coverallsapp/github-action to create new checks | ||
contents: read # for actions/checkout to fetch code | ||
name: Lint | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest] | ||
node: [16] | ||
runs-on: ${{ matrix.os }} | ||
env: | ||
TEST_ENV: ${{ matrix.test_env || 'production' }} | ||
|
||
services: | ||
mongo: | ||
image: 'mongo:3.7' | ||
ports: | ||
# Maps port 27017 on service container to the host | ||
- 27017:27017 | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- run: cp install/package.json package.json | ||
|
||
- name: Install Node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node }} | ||
|
||
- name: NPM Install | ||
uses: bahmutov/npm-install@v1 | ||
with: | ||
useLockFile: false | ||
|
||
- name: Setup on MongoDB | ||
env: | ||
SETUP: >- | ||
{ | ||
"url": "http://127.0.0.1:4567", | ||
"secret": "abcdef", | ||
"admin:username": "admin", | ||
"admin:email": "[email protected]", | ||
"admin:password": "hAN3Eg8W", | ||
"admin:password:confirm": "hAN3Eg8W", | ||
"database": "mongo", | ||
"mongo:host": "127.0.0.1", | ||
"mongo:port": 27017, | ||
"mongo:username": "", | ||
"mongo:password": "", | ||
"mongo:database": "nodebb" | ||
} | ||
CI: >- | ||
{ | ||
"host": "127.0.0.1", | ||
"port": 27017, | ||
"database": "ci_test" | ||
} | ||
run: | | ||
node app --setup="${SETUP}" --ci="${CI}" | ||
- name: Run ESLint | ||
run: npm run lint |
Oops, something went wrong.