Wolf Clement пре 2 година
родитељ
комит
06aec46130
7 измењених фајлова са 34 додато и 15 уклоњено
  1. 20 0
      .github/workflows/code-scan.yml
  2. 1 1
      index.js
  3. 9 9
      ranked.js
  4. 1 1
      util/config.js
  5. 2 2
      util/helpers.js
  6. 1 1
      util/recompute_ranks.js
  7. 0 1
      website.js

+ 20 - 0
.github/workflows/code-scan.yml

@@ -0,0 +1,20 @@
+name: code-scan
+on: [push, pull_request]
+jobs:
+  code-scan:
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@v2
+      - name: Cache node modules
+        uses: actions/cache@v2
+        env:
+          cache-name: cache-node-modules
+        with:
+          path: ~/.yarn
+          key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/yarn.lock') }}
+          restore-keys: |
+            ${{ runner.os }}-build-${{ env.cache-name }}-
+      - name: Install node modules
+        run: yarn install
+      - name: Run ESLint
+        run: yarn run eslint .

+ 1 - 1
index.js

@@ -14,7 +14,7 @@ import Config from './util/config.js';
 
 if (Config.ENABLE_SENTRY) {
   Sentry.init({
-    dsn: Config.sentry_dsn
+    dsn: Config.sentry_dsn,
   });
 }
 

+ 9 - 9
ranked.js

@@ -324,7 +324,7 @@ async function join_lobby(lobby, client, creator, creator_discord_id, created_ju
       if (err.message == 'Internal server error.') {
         await player.user.sendMessage('Sorry, osu!api is having issues at the moment, so you cannot join o!RL lobbies. See https://status.ppy.sh/ for more info.');
       } else {
-        capture_sentry_exception(err)
+        capture_sentry_exception(err);
       }
     }
   }
@@ -342,7 +342,7 @@ async function join_lobby(lobby, client, creator, creator_discord_id, created_ju
         console.log(`#mp_${lobby.id} Closed.`);
       }
     } catch (err) {
-      capture_sentry_exception(err)
+      capture_sentry_exception(err);
     }
   });
 
@@ -364,7 +364,7 @@ async function join_lobby(lobby, client, creator, creator_discord_id, created_ju
         if (err.message == 'Internal server error.') {
           await evt.player.user.sendMessage('Sorry, osu!api is having issues at the moment, so you cannot join o!RL lobbies. See https://status.ppy.sh/ for more info.');
         } else {
-          capture_sentry_exception(err)
+          capture_sentry_exception(err);
         }
       }
 
@@ -380,7 +380,7 @@ async function join_lobby(lobby, client, creator, creator_discord_id, created_ju
       await update_ranked_lobby_on_discord(lobby);
     } catch (err) {
       console.error(`#mp_${lobby.id} Error in playerJoined event handler:`, err);
-      capture_sentry_exception(err)
+      capture_sentry_exception(err);
     }
   });
 
@@ -437,7 +437,7 @@ async function join_lobby(lobby, client, creator, creator_discord_id, created_ju
         return;
       }
     } catch (err) {
-      capture_sentry_exception(err)
+      capture_sentry_exception(err);
     }
   });
 
@@ -460,7 +460,7 @@ async function join_lobby(lobby, client, creator, creator_discord_id, created_ju
 
       await lobby.startMatch();
     } catch (err) {
-      capture_sentry_exception(err)
+      capture_sentry_exception(err);
     }
   });
 
@@ -484,7 +484,7 @@ async function join_lobby(lobby, client, creator, creator_discord_id, created_ju
 
       await update_ranked_lobby_on_discord(lobby);
     } catch (err) {
-      capture_sentry_exception(err)
+      capture_sentry_exception(err);
     }
   });
 
@@ -509,7 +509,7 @@ async function join_lobby(lobby, client, creator, creator_discord_id, created_ju
         }
       }
     } catch (err) {
-      capture_sentry_exception(err)
+      capture_sentry_exception(err);
     }
   });
 
@@ -833,7 +833,7 @@ async function start_ranked(client, _map_db) {
       }
     } catch (err) {
       console.log('Failed to process PM: ' + err);
-      capture_sentry_exception(err)
+      capture_sentry_exception(err);
     }
   });
 }

+ 1 - 1
util/config.js

@@ -2,4 +2,4 @@ import fs from 'fs';
 
 const Config = JSON.parse(fs.readFileSync('./config.json'));
 
-export default Config;
+export default Config;

+ 2 - 2
util/helpers.js

@@ -3,6 +3,6 @@ import Config from './config.js';
 
 export function capture_sentry_exception(err) {
   if (Config.ENABLE_SENTRY) {
-      Sentry.captureException(err);
+    Sentry.captureException(err);
   }
-}
+}

+ 1 - 1
util/recompute_ranks.js

@@ -35,7 +35,7 @@ async function clear_discord_roles() {
     'Platinum': Config.discord_platinum_role_id,
     'Diamond': Config.discord_diamond_role_id,
     'Legendary': Config.discord_legendary_role_id,
-    'The One': Config.discord_the_one_role_id
+    'The One': Config.discord_the_one_role_id,
   };
 
   const discord_db = await open({

+ 0 - 1
website.js

@@ -9,7 +9,6 @@ import {get_rank, get_rank_text_from_id} from './elo_mmr.js';
 import {update_discord_role, update_discord_username} from './discord_updates.js';
 import SQL from 'sql-template-strings';
 import Config from './util/config.js';
-import {capture_sentry_exception} from './util/helpers.js';
 
 function median(numbers) {
   if (numbers.length == 0) return 0;