From ba8e0aa8630e936e4c882cca50bbac9919cdd750 Mon Sep 17 00:00:00 2001 From: Chris Hennes Date: Tue, 26 Jan 2021 20:38:51 -0600 Subject: [PATCH] Minor tweaks to Start recommended by LGTM Using the results of the vulnerability scan at lgtm.com, some minor changes were made. First, all Python exception handling now explicitly catches Exception, rather than BaseException (which would include SystemExit and KeyboardInterrupt). Second, unused imports were removed. Third, a couple of unnecessary or unused assignments were addressed. Finally, the JavaScript was modified to explicitly declare the local ddiv variable when needed. --- src/Mod/Start/StartPage/EnableDownload.py | 2 +- src/Mod/Start/StartPage/LoadMRU.py | 2 +- src/Mod/Start/StartPage/StartPage.js | 8 ++++---- src/Mod/Start/StartPage/StartPage.py | 15 +++++++-------- 4 files changed, 13 insertions(+), 14 deletions(-) diff --git a/src/Mod/Start/StartPage/EnableDownload.py b/src/Mod/Start/StartPage/EnableDownload.py index 4baca89549..f7f117969e 100644 --- a/src/Mod/Start/StartPage/EnableDownload.py +++ b/src/Mod/Start/StartPage/EnableDownload.py @@ -20,6 +20,6 @@ #* * #*************************************************************************** -import FreeCAD,FreeCADGui +import FreeCAD rf=FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Start") rf.SetBool("AllowDownload",True) diff --git a/src/Mod/Start/StartPage/LoadMRU.py b/src/Mod/Start/StartPage/LoadMRU.py index 4c7889daa3..7b7e14c7d6 100644 --- a/src/Mod/Start/StartPage/LoadMRU.py +++ b/src/Mod/Start/StartPage/LoadMRU.py @@ -20,7 +20,7 @@ #* * #*************************************************************************** -import FreeCADGui,sys +import FreeCADGui # MRU will be given before this script is run rf=FreeCAD.ParamGet("User parameter:BaseApp/Preferences/RecentFiles") FreeCADGui.loadFile(rf.GetString("MRU"+str(MRU))) diff --git a/src/Mod/Start/StartPage/StartPage.js b/src/Mod/Start/StartPage/StartPage.js index ca70689613..ad906f89e9 100644 --- a/src/Mod/Start/StartPage/StartPage.js +++ b/src/Mod/Start/StartPage/StartPage.js @@ -31,7 +31,7 @@ function load() { if (allowDownloads == 1) { // load latest commits - ddiv = document.getElementById("commits"); + var ddiv = document.getElementById("commits"); ddiv.innerHTML = "Connecting..."; var tobj=new JSONscriptRequest('https://api.github.com/repos/FreeCAD/FreeCAD/commits?callback=printCommits'); tobj.buildScriptTag(); // Build the script tag @@ -61,7 +61,7 @@ function printCommits(data) { // json callback for git commits - ddiv = document.getElementById('commits'); + var ddiv = document.getElementById('commits'); ddiv.innerHTML = "Received"; var html = ['