@@ -34,8 +34,8 @@ protected DeepCodeUtilsBase(
3434 initSupportedExtentionsAndConfigFiles ();
3535 }
3636
37- protected static Set <String > supportedExtensions = Collections .emptySet ();
38- protected static Set <String > supportedConfigFiles = Collections .emptySet ();
37+ private static Set <String > supportedExtensions = Collections .emptySet ();
38+ private static Set <String > supportedConfigFiles = Collections .emptySet ();
3939
4040 public List <Object > getAllSupportedFilesInProject (
4141 @ NotNull Object project , boolean scanAllMissedIgnoreFile , @ Nullable Object progress ) {
@@ -64,6 +64,12 @@ public List<Object> getAllSupportedFilesInProject(
6464 // clean up cashes built without .ignore files parsing
6565 if (!scanAllMissedIgnoreFile ) ignoreInfoHolder .removeProject (project );
6666
67+ // do not proceed (send) files if only configFiles (.gitignore or .dcignore) presence
68+ final boolean containsOnlyConfigFiles = result .stream ().allMatch (this ::isSupportedConfigFile );
69+ if (containsOnlyConfigFiles ) {
70+ result .clear ();
71+ }
72+
6773 if (result .isEmpty ()) dcLogger .logWarn ("Empty supported files list for project: " + project );
6874 return result ;
6975 }
@@ -77,11 +83,19 @@ public boolean isSupportedFileFormat(@NotNull Object file) {
7783 if (ignoreInfoHolder .isIgnoredFile (file ) || isGitIgnoredExternalCheck (file )) return false ;
7884 long fileLength = getFileLength (file );
7985 boolean supported = 0 < fileLength && fileLength < MAX_FILE_SIZE &&
80- (supportedExtensions . contains ( getFileExtention ( file )) || supportedConfigFiles . contains ( pdUtils . getFileName ( file ) ));
86+ (hasSupportedExtension ( file ) || isSupportedConfigFile ( file ));
8187 // DCLogger.getInstance().info("isSupportedFileFormat ends for " + psiFile.getName());
8288 return supported ;
8389 }
8490
91+ public boolean hasSupportedExtension (@ NotNull Object file ) {
92+ return supportedExtensions .contains (getFileExtention (file ));
93+ }
94+
95+ public boolean isSupportedConfigFile (@ NotNull Object file ) {
96+ return supportedConfigFiles .contains (pdUtils .getFileName (file ));
97+ }
98+
8599 protected abstract long getFileLength (@ NotNull Object file );
86100
87101 protected abstract String getFileExtention (@ NotNull Object file );
@@ -108,23 +122,59 @@ private void initSupportedExtentionsAndConfigFiles() {
108122 + filtersResponse .getStatusCode ()
109123 + " "
110124 + filtersResponse .getStatusDescription ());
125+
126+ // updated 05.2022
111127 supportedExtensions =
112128 new HashSet <>(
113129 Arrays .asList (
114- "cc" , "htm" , "cpp" , "cxx" , "c" , "vue" , "h" , "hpp" , "hxx" , "es6" , "js" , "py" , "es" ,
115- "jsx" , "java" , "tsx" , "html" , "ts" ));
130+ "phtml" ,
131+ "vue" ,
132+ "xsd" ,
133+ "slim" ,
134+ "py" ,
135+ "es6" ,
136+ "js" ,
137+ "jsx" ,
138+ "pom" ,
139+ "java" ,
140+ "erb" ,
141+ "xml" ,
142+ "aspx" ,
143+ "tsx" ,
144+ "html" ,
145+ "swift" ,
146+ "cc" ,
147+ "htm" ,
148+ "cpp" ,
149+ "cxx" ,
150+ "c" ,
151+ "h" ,
152+ "go" ,
153+ "haml" ,
154+ "hpp" ,
155+ "hxx" ,
156+ "kt" ,
157+ "rhtml" ,
158+ "cls" ,
159+ "cjs" ,
160+ "es" ,
161+ "ejs" ,
162+ "rb" ,
163+ "cs" ,
164+ "wxs" ,
165+ "mjs" ,
166+ "php" ,
167+ "config" ,
168+ "ts"
169+ )
170+ );
116171 supportedConfigFiles =
117172 new HashSet <>(
118173 Arrays .asList (
119- "pylintrc" ,
120- "ruleset.xml" ,
121- ".eslintrc.json" ,
122- ".pylintrc" ,
123- ".eslintrc.js" ,
124- "tslint.json" ,
125- ".pmdrc.xml" ,
126- ".ruleset.xml" ,
127- ".eslintrc.yml" ));
174+ ".gitignore" ,
175+ ".dcignore"
176+ )
177+ );
128178 }
129179 }
130180
0 commit comments