From 5bb172658e197728cbb99bcd2e9bde100e87b28e Mon Sep 17 00:00:00 2001 From: Rtfsc8 Date: Fri, 18 Jan 2019 18:04:51 +0800 Subject: [PATCH] Fix: Not processing empty file. --- .gitignore | 48 ++---------------------------------------------- code-analyzer.js | 4 ++++ 2 files changed, 6 insertions(+), 46 deletions(-) diff --git a/.gitignore b/.gitignore index 52f6006..2242592 100644 --- a/.gitignore +++ b/.gitignore @@ -159,40 +159,12 @@ local.properties # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 -# User-specific stuff -.idea/**/workspace.xml -.idea/**/tasks.xml -.idea/**/usage.statistics.xml -.idea/**/dictionaries -.idea/**/shelf - -# Sensitive or high-churn files -.idea/**/dataSources/ -.idea/**/dataSources.ids -.idea/**/dataSources.local.xml -.idea/**/sqlDataSources.xml -.idea/**/dynamic.xml -.idea/**/uiDesigner.xml -.idea/**/dbnavigator.xml - -# Gradle -.idea/**/gradle.xml -.idea/**/libraries - -# Gradle and Maven with auto-import -# When using Gradle or Maven with auto-import, you should exclude module files, -# since they will be recreated, and may cause churn. Uncomment if using -# auto-import. -# .idea/modules.xml -# .idea/*.iml -# .idea/modules +# ignore .idea directory +.idea/ # CMake cmake-build-*/ -# Mongo Explorer plugin -.idea/**/mongoSettings.xml - # File-based project format *.iws @@ -205,25 +177,9 @@ out/ # JIRA plugin atlassian-ide-plugin.xml -# Cursive Clojure plugin -.idea/replstate.xml - # Crashlytics plugin (for Android Studio and IntelliJ) com_crashlytics_export_strings.xml crashlytics.properties crashlytics-build.properties fabric.properties -# Editor-based Rest Client -.idea/httpRequests - -.idea/checkstyle-idea.xml -.idea/copyright/ -.idea/encodings.xml -.idea/inspectionProfiles/ -.idea/markdown-navigator.xml -.idea/markdown-navigator/ -.idea/misc.xml -.idea/modules.xml -.idea/staruml-java.iml -.idea/vcs.xml diff --git a/code-analyzer.js b/code-analyzer.js index 1edefc7..0146bb9 100644 --- a/code-analyzer.js +++ b/code-analyzer.js @@ -159,6 +159,10 @@ class JavaCodeAnalyzer { this._files.forEach(file => { var data = fs.readFileSync(file, 'utf8') try { + /* Not processing empty file @author Rtfsc8(rtfsc8@rtfsc8.top) */ + if (!!!data) { + return; + } var ast = java7.parse(data) this._currentCompilationUnit = ast this._currentCompilationUnit.file = file