You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Wenjun Ruan (Jira)" <ji...@apache.org> on 2022/01/04 11:05:00 UTC

[jira] [Created] (FLINK-25517) Extract duplicate code in JarFileChecker

Wenjun Ruan created FLINK-25517:
-----------------------------------

             Summary: Extract duplicate code in JarFileChecker
                 Key: FLINK-25517
                 URL: https://issues.apache.org/jira/browse/FLINK-25517
             Project: Flink
          Issue Type: Improvement
          Components: Build System / CI
            Reporter: Wenjun Ruan


Hi community,

I find there are some code in JarFileChecker.java can be extracted to a method.

For example:

 
{code:java}
// code placeholder
Files.walk(path)
        .filter(file -> file.toString().endsWith(".jar"))
        .collect(Collectors.toList()) 

may be better to:
return Files.walk(path)
        .filter(JarFileChecker::isJarFile)
        .collect(Collectors.toList());{code}
 
{code:java}
// code placeholder
!getFileName(path).startsWith("license")
!getFileName(path).startsWith("notice")
!getFileName(path).endsWith(".ftl")

may be better to:
!fileNameStartsWith(path, "license")
!fileNameStartsWith(path, "notice") 
!fileNameEndWith(path, ".ftl"){code}
This is not a must, but I think this change may make the code cleaner.

 

 

 

 



--
This message was sent by Atlassian Jira
(v8.20.1#820001)