Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configuration explorer cleanup #224

Open
wants to merge 179 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
179 commits
Select commit Hold shift + click to select a range
25dbf61
Created projects structure
klein648 May 2, 2024
78305f9
Structure expanded
klein648 May 10, 2024
a240ef7
Added initial core for configuration explorer
klein648 Jun 9, 2024
e54f27b
Added configuration explorer to build.sbt
klein648 Jun 9, 2024
409c296
ce dependencies implemented into the sbt
klein648 Jun 13, 2024
9d58ebc
preparations for implementation of FileLocator
klein648 Jun 15, 2024
0376790
Implemented the ability to locate all configuration Files within the …
klein648 Jun 20, 2024
45050da
Code cleanup
klein648 Jun 20, 2024
44f2ce6
Searchfile() function now returns a List of the found files
klein648 Jun 20, 2024
87191ca
Code cleanup
klein648 Jun 20, 2024
d1793e9
Added more configuration files to file search
klein648 Jun 20, 2024
b1ee3c1
Added traits and case classes that represent the configs structure
klein648 Aug 13, 2024
28373cc
Implemented frame of comment object
klein648 Aug 24, 2024
50a2c16
Intermediate commit for comment parser
klein648 Aug 24, 2024
654bbe5
Intermediate commit for comment parser wrapper (unsure if I still nee…
klein648 Aug 24, 2024
b68c765
added empty line on print message
klein648 Aug 24, 2024
e5a8bb6
Added test method for file locator and test method for comment parser
klein648 Aug 24, 2024
8cafe86
switched order of config files
klein648 Aug 24, 2024
48b2b6d
created testfile for testing the comment parser
klein648 Aug 24, 2024
b7cb915
made parser skip to next line when a comment is found before an entry
klein648 Aug 24, 2024
40046bc
Implemented end condition for parseList
klein648 Aug 24, 2024
6c59f44
Housekeeping regarding the nextComment property
klein648 Aug 24, 2024
12a37a6
Implemented frame for parseObject method
klein648 Aug 24, 2024
23ffc6c
Fixed compilation error that occurred during refactoring
klein648 Aug 24, 2024
4e90fd1
Implemented correct flags for multi-line values
klein648 Sep 5, 2024
e6f5f53
FIX: ConfigList did not inherit from ConfigNode
klein648 Sep 5, 2024
152b25b
Implemented Config Object parse
klein648 Sep 5, 2024
8862c91
FIX: Compiler errors
klein648 Sep 5, 2024
7f733bc
FIX: runtime errors when parsing all projects configs
klein648 Sep 5, 2024
57287ce
Made toHTML and commitComments methods mandatory
klein648 Sep 11, 2024
3686739
Added comments and config for HTML components
klein648 Sep 11, 2024
98ecd87
FIX: fixed typo in comment flag
klein648 Sep 11, 2024
4f3cf42
Added Comments part 1
klein648 Sep 11, 2024
a0a45a5
Added template.html
klein648 Sep 12, 2024
8849360
Implemented toHTML() function
klein648 Sep 12, 2024
03b2b13
Removed commitComments() from configNode (not needed)
klein648 Sep 12, 2024
0c3171c
Exclude target paths as they produce duplicates
klein648 Sep 12, 2024
7b8b13b
Implemented HTML exporter
klein648 Sep 12, 2024
b781c3b
Changed title of template
klein648 Sep 12, 2024
f8c5560
Implemented export options for label and brief
klein648 Sep 12, 2024
05a5a03
Moved Path information of the config file into the comment label
klein648 Sep 12, 2024
8fe86d2
Moved Path information of the config file into the comment label
klein648 Sep 12, 2024
d40b07b
Implemented separated information for comments
klein648 Sep 12, 2024
1fe9b15
Fixed comments / added export setting
klein648 Sep 12, 2024
cd0df91
Implemented export to HTML
klein648 Sep 12, 2024
21637fb
FIX: The parser interpreted empty lines between comments as empty values
klein648 Sep 12, 2024
f75e4fa
FIX: Rename of the expandBox object has not been transferred to the J…
klein648 Sep 12, 2024
b5e710c
Feature: Empty config files are not shown on report
klein648 Sep 12, 2024
1a8d2d8
Removed placeholder comment
klein648 Sep 12, 2024
0e5bc74
Using codebrackets for properly displaying values
klein648 Sep 12, 2024
f35cbba
Changed comment spacing to pragraphs from double line breaks
klein648 Sep 12, 2024
35debad
Fixed view for html elements that are present in the config files
klein648 Sep 12, 2024
3ab2530
FIX: line remains were not transferred back after closing an object
klein648 Sep 12, 2024
b686a7a
Fixes recommended by IntelliJ
klein648 Sep 12, 2024
7af5f96
Greatly simplified commentParser by making it stateful
klein648 Sep 12, 2024
4320440
removed unnecessary print statement
klein648 Sep 12, 2024
a02e3b9
Added all missing config files
klein648 Sep 12, 2024
86841f8
FIX: Parser did not strip the "," separating two values in a list
klein648 Sep 12, 2024
a4e8f5b
removed testcases.conf as it was no valid HOCON
klein648 Sep 12, 2024
bfe3079
Cleaned up import statements
klein648 Sep 12, 2024
f2dd0f3
Added Comments
klein648 Sep 13, 2024
1115e03
Fixed Package naming
klein648 Sep 14, 2024
fba4654
Added:
klein648 Sep 30, 2024
a468b66
Code cleanup
klein648 Sep 30, 2024
60d40bf
More code cleanup
klein648 Sep 30, 2024
b9e1d94
Fixed parser crash that was implemented in cleanup
klein648 Oct 4, 2024
aab9aed
refactored filelocator for more general use
klein648 Oct 4, 2024
6347855
Removed non-opal configs from file filter
klein648 Oct 4, 2024
ee59120
Implemented merge for comments at collapse
klein648 Oct 4, 2024
fed7fa0
FIX: Merge Errors in comment
klein648 Oct 6, 2024
626d2a0
Refactored files to be ConfigObjects, fixed errors with expand
klein648 Oct 6, 2024
634e761
Removed t print (why was that here?)
klein648 Oct 6, 2024
8016830
Variable refactoring did not finish
klein648 Oct 6, 2024
594ae07
Mitigated risk of type error and added more infos in case two incompa…
klein648 Oct 6, 2024
ec8af86
Added label that represents the aggregated reference.conf
klein648 Oct 6, 2024
c0c65cb
Implemented a (sort of) Syntax Checker to the parsing process
klein648 Oct 6, 2024
3d725f7
Refactored parseComments to parseFile
klein648 Oct 6, 2024
a7de264
Fixed offset on key prints
klein648 Oct 6, 2024
f4d9239
- Added compatibility for root brackets and associated comments
klein648 Oct 6, 2024
89777d1
Added root brackets and config file level documentation
klein648 Oct 6, 2024
b5d8a63
Added dependency on bytecode representation
klein648 Oct 6, 2024
c81bc7b
FIX: Entries with comments, but without brief description did not rec…
klein648 Oct 6, 2024
4f45704
Added trim to object keys
klein648 Oct 10, 2024
1628121
Implemented alphabetical sorting for html output
klein648 Oct 10, 2024
f4e4307
Expanded doc function to include config documentation
klein648 Oct 11, 2024
448947d
FIX: Nested keys that ended up to be overlapping after expansion were…
klein648 Oct 11, 2024
afec964
FIX: Nested keys that ended up to be overlapping after expansion were…
klein648 Oct 11, 2024
f9d3ac5
Strips the double quotes from a key
klein648 Oct 11, 2024
cec7c5c
Strips the double quotes from a key
klein648 Oct 11, 2024
0c47cbf
Implemented Class replacement
klein648 Oct 11, 2024
a977256
Added toggle in config for class replacement
klein648 Oct 12, 2024
eb37679
Excluded test archives that end on .gz from the class replacing jar a…
klein648 Oct 13, 2024
c34c972
FIX: Comment Parser was not parsing the last line of a file
klein648 Oct 14, 2024
2cbee05
Code simplification
klein648 Oct 14, 2024
8f278c2
Enabled scalafmt
klein648 Oct 18, 2024
762174c
Managed IntelliJ commit issues
klein648 Oct 18, 2024
26e2b7b
Removed multi import
klein648 Oct 18, 2024
992321c
Added typesafe config cleanly to Dependencies
klein648 Oct 18, 2024
480eda1
Added comments
klein648 Oct 18, 2024
602bc0c
Added readme
klein648 Oct 18, 2024
1bf91eb
Added readme
klein648 Oct 18, 2024
5d488ce
Fixed missing question mark in readme
klein648 Oct 18, 2024
d275e22
Fixed scaladoc warnings
klein648 Oct 18, 2024
ec98273
Added dependenies and IntegrationTest configuration
klein648 Oct 18, 2024
f1a6c73
Added license disclaimers
klein648 Oct 18, 2024
339115f
Cleaned up duplicate. Added build version as system parameter for ce
klein648 Oct 19, 2024
0b0e629
Hands over Version build to ce
klein648 Oct 19, 2024
6707646
Fixed export paths
klein648 Oct 19, 2024
653df48
Fixed comments
klein648 Oct 19, 2024
ec6aa4b
Merge branch 'develop' into configuration_explorer_cleanup
klein648 Oct 20, 2024
f02cdb8
Fixed package import for comment
klein648 Oct 24, 2024
c8fcf05
Refactored comment to only contain the fully parsed comment
klein648 Oct 25, 2024
0784bbe
Replaced addOne() with +=
klein648 Oct 25, 2024
27730a6
Removed unnecessary this
klein648 Oct 26, 2024
4e316aa
restructured to change constraints to val
klein648 Oct 26, 2024
dd2c2d0
removed duplicate trims from comment
klein648 Oct 26, 2024
1a5ec3a
Added line breaks to html export to improve readability
klein648 Oct 26, 2024
e312230
Fixed odd case for none existing labels
klein648 Oct 26, 2024
efcb2f8
Avoid reading all the lines at once. Instead not using an iterator th…
klein648 Oct 26, 2024
87e7259
Made instance variables private as they are only used in the parsing …
klein648 Oct 26, 2024
fc33d0b
Using an iterator to read the lines from the file one by one instead …
klein648 Oct 26, 2024
3c8e1f3
Replaced source directory with the one from the file Locator
klein648 Oct 26, 2024
7e78943
Fixed typo in comment
klein648 Oct 26, 2024
3ff2e29
replaced addOne with +=
klein648 Oct 26, 2024
bb52cdf
Refactored Iterateconfigs to iterateConfigs
klein648 Oct 26, 2024
531468b
Refactored local variable names
klein648 Oct 26, 2024
c4a3984
Refactored addition and fixed a bug involving necessary parenthesis
klein648 Oct 26, 2024
7dcbbea
removed unneccesary collapse call
klein648 Oct 26, 2024
90be780
replaced for loop with forall()
klein648 Oct 26, 2024
8006f9a
refactored local variables
klein648 Oct 26, 2024
9aed96a
Replaced for loops with foreach
klein648 Oct 26, 2024
7e713d4
Removed Scala Version from search from target folder
klein648 Oct 26, 2024
3487ca8
Removed ambiguous comment
klein648 Oct 26, 2024
a3e4d94
Refactored SearchFiles() -> searchFiles()
klein648 Oct 26, 2024
d36435b
Start checking for empty comment first
klein648 Oct 26, 2024
e9e7270
Made the brief description length a configurable value
klein648 Oct 27, 2024
10a24a7
documented replaceClasses
klein648 Oct 27, 2024
01a6ed9
Fixed scaladoc comments
klein648 Oct 27, 2024
3ffbee6
Removed typesafe config from the dependencies
klein648 Oct 27, 2024
79ea534
Rebuilt Comment export to use a string builder
klein648 Nov 1, 2024
52894ee
Initializing the iterator as empty
klein648 Nov 1, 2024
ea80bd2
Importing configFactory
klein648 Nov 1, 2024
85779e3
Refactored Comment class to DocumentationComment class
klein648 Nov 1, 2024
44e279d
Implemented OPALLogger for output
klein648 Nov 1, 2024
7bdf267
Removed unnecessary trims
klein648 Nov 1, 2024
f90b791
Fixed comments
klein648 Nov 1, 2024
f24afbb
Removed trim
klein648 Nov 1, 2024
36ae3d1
Renamed Source Object to ConfigurationExplorer
klein648 Nov 1, 2024
644c7af
Removed iterator on string for finding terminating symbol
klein648 Nov 1, 2024
04f2da9
Separated parsing a single line of comment into a separate method.
klein648 Nov 1, 2024
c612982
Using index variable to save duplicate string searches
klein648 Nov 1, 2024
574482d
Rebuilt toHTML methods to both use a StringBuilder and String interpo…
klein648 Nov 1, 2024
a36b5f2
removed extractValue method and implemented String builder for multi-…
klein648 Nov 1, 2024
7397d3a
Renamed internal method to avoid ambiguities
klein648 Nov 1, 2024
aac8d6b
Replaced zip with index with indexWhere
klein648 Nov 1, 2024
bb25571
Made multiple return values immutable
klein648 Nov 1, 2024
cb419ff
Fixed typo
klein648 Nov 1, 2024
33a373d
Simplified isEmpty method
klein648 Nov 1, 2024
758b26c
specified exception type
klein648 Nov 1, 2024
3cbdf7d
Made Comment Parser an inner class of CommentParserWrapper
klein648 Nov 1, 2024
430c4fb
removed mutability of Config
klein648 Nov 1, 2024
d80abcc
removed currentComment var
klein648 Nov 1, 2024
9eeb20e
removed FirstIndexOfChars
klein648 Nov 1, 2024
0ce173a
Changed immutable.Seq to Seq
klein648 Nov 1, 2024
fee3be0
Refactored findJarArchives
klein648 Nov 1, 2024
b5ea6ff
Updated FileLocator comments
klein648 Nov 1, 2024
1252c98
Implemented proper escaping of special characters
klein648 Nov 1, 2024
a73a311
Style change
klein648 Nov 1, 2024
0b73533
Changed head definition
klein648 Nov 1, 2024
319d2ed
Reworked iterateConfigs method
klein648 Nov 3, 2024
a4527e6
Removed duplicate .depends on
klein648 Nov 3, 2024
e377228
Updated projectDependencies
klein648 Nov 3, 2024
23bdef6
Made values of DocumentationComment immutable and fixed everything th…
klein648 Nov 3, 2024
276fa09
Reformatted with scalafmt
klein648 Nov 3, 2024
6148d49
Reworked export process to only use one string builder
klein648 Nov 3, 2024
a816811
Removed unneccessary toSeq()
klein648 Nov 3, 2024
b1275b2
Refactored CommentParserWrapper into CommentParser
klein648 Nov 3, 2024
8d20035
Fixed comments
klein648 Nov 3, 2024
ab28661
Updated ProjectDependencies.svg
klein648 Nov 5, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion TOOLS/ce/src/main/scala/org.opalj.ce/CommentParser.scala
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import org.opalj.log.OPALLogger
* The Comment Parser is responsible for parsing the HOCON files and its comments.
* Do NOT use this class directly, use ConfigParserWrapper for safe parsing instead.
*/
class CommentParser() {
class CommentParser {
private var iterator: Iterator[String] = Iterator.empty
private var line = ""
implicit val logContext: LogContext = GlobalLogContext
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package org.opalj
package ce

import java.nio.file.Path
import scala.collection.immutable
import scala.collection.mutable
import scala.collection.mutable.ListBuffer

Expand All @@ -18,7 +19,7 @@ class CommentParserWrapper {
* @param filepaths accepts a list of full paths to the HOCON config files that shall be parsed.
* @return is a list of the parsed configuration files, paired with the path they originate from.
*/
def iterateConfigs(filepaths: mutable.Buffer[Path], rootDirectory: Path): ListBuffer[ConfigObject] = {
def iterateConfigs(filepaths: Iterable[Path], rootDirectory: Path): immutable.Seq[ConfigObject] = {
klein648 marked this conversation as resolved.
Show resolved Hide resolved
val commentedConfigs = new ListBuffer[ConfigObject]
for (filepath <- filepaths) {
commentedConfigs += ParseComments(filepath, rootDirectory)
Expand Down Expand Up @@ -47,7 +48,7 @@ class CommentParserWrapper {
config.collapse()
}

commentedConfigs
commentedConfigs.toSeq
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ package ce

import java.io.File
import java.nio.file.Paths
import scala.collection.mutable.ListBuffer

import com.typesafe.config.Config
import com.typesafe.config.ConfigFactory
Expand Down Expand Up @@ -36,15 +35,15 @@ object ConfigurationExplorer extends App {

// Replace class type values
if (conf.getBoolean("org.opalj.ce.replaceSubclasses")) {
val se = new SubclassExtractor(locator, buildVersion)
val se = new SubclassExtractor(locator.FindJarArchives(buildVersion).toArray)
for (config <- configs) {
config.replaceClasses(se)
}
}

// Export
val HE = new HTMLExporter(
configs.asInstanceOf[ListBuffer[ConfigNode]],
configs,
Paths.get(locator.getProjectRoot + conf.getString("org.opalj.ce.html.template"))
)
HE.exportHTML(conf, new File(locator.getProjectRoot + conf.getString("org.opalj.ce.html.export")))
Expand Down
16 changes: 8 additions & 8 deletions TOOLS/ce/src/main/scala/org.opalj.ce/FileLocator.scala
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import java.nio.file.Files
import java.nio.file.Path
import java.nio.file.Paths
import java.nio.file.attribute.BasicFileAttributes
import scala.collection.mutable
import scala.collection.immutable.Seq
import scala.collection.mutable.ListBuffer
import scala.jdk.CollectionConverters._

Expand Down Expand Up @@ -39,21 +39,21 @@ class FileLocator(var config: Config) {
* Loads the filenames of the configuration files that shall be parsed.
* @return is a List of the filenames that shall be parsed by the Configuration Explorer.
*/
def getConfigurationFilenames: mutable.Buffer[String] = {
def getConfigurationFilenames: Seq[String] = {
val projectNames = config.getStringList("org.opalj.ce.configurationFilenames").asScala

OPALLogger.info("Configuration Explorer", "Loaded the following Filenames: ")
for (filename <- projectNames) {
OPALLogger.info("Configuration Explorer", filename)
}
projectNames
projectNames.toSeq
}

/**
* Finds all files that are named after one of the configuration filenames and are NOT within the target folder structure.
* @return returns a List of full FilePaths to all found config files.
*/
def getConfigurationPaths: mutable.Buffer[Path] = {
def getConfigurationPaths: Seq[Path] = {
val projectNames = getConfigurationFilenames
searchFiles(projectNames)
}
Expand All @@ -63,7 +63,7 @@ class FileLocator(var config: Config) {
* @param Filenames Accepts a List of all filenames that should be included in the result.
* @return returns a List of full FilePaths to all found files.
*/
def searchFiles(Filenames: mutable.Buffer[String]): mutable.Buffer[Path] = {
def searchFiles(Filenames: Seq[String]): Seq[Path] = {
val projectRoot = Paths.get(getProjectRoot)
val foundFiles = ListBuffer[Path]()

Expand All @@ -82,15 +82,15 @@ class FileLocator(var config: Config) {
}
}
)
foundFiles
foundFiles.toSeq
}

/**
* Finds all jar archives in the project, where the file name contains the pathWildcard.
* @param pathWildcard accepts a String to filter the filenames of the jar archives. Will only return jar archives that contain the parameter in their file name.
* @return Will only return jar archives that contain the parameter in their file name and that are not in the bg-jobs folder.
*/
def FindJarArchives(pathWildcard: String): mutable.Buffer[File] = {
def FindJarArchives(pathWildcard: String): Seq[File] = {
klein648 marked this conversation as resolved.
Show resolved Hide resolved
val projectRoot = Paths.get(getProjectRoot)
val foundFiles = ListBuffer[File]()
Files.walkFileTree(
Expand All @@ -108,6 +108,6 @@ class FileLocator(var config: Config) {
}
}
)
foundFiles
foundFiles.toSeq
}
}
3 changes: 1 addition & 2 deletions TOOLS/ce/src/main/scala/org.opalj.ce/HTMLExporter.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ package ce
import java.io.File
import java.io.PrintWriter
import java.nio.file.Path
import scala.collection.mutable.ListBuffer
import scala.io.Source
import scala.util.Using

Expand All @@ -16,7 +15,7 @@ import com.typesafe.config.Config
* @param ConfigList Accepts a List of parsed Configuration Files.
* @param templatePath Accepts a Path to the HTML Template that should be used.
*/
class HTMLExporter(ConfigList: ListBuffer[ConfigNode], templatePath: Path) {
class HTMLExporter(ConfigList: Iterable[ConfigNode], templatePath: Path) {
/**
* Exports the ConfigList into an HTML file.
* The following parameters are all read from the Configuration Explorer config, however, the CE config was not handed over due to namespace conflicts with the internally used ConfigNode.
Expand Down
3 changes: 1 addition & 2 deletions TOOLS/ce/src/main/scala/org.opalj.ce/SubclassExtractor.scala
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ import org.opalj.br.analyses.Project
* @param f accepts any initialized FileLocator.
* @param pathWildcard accepts a Wildcard that must be present in every .jar files file name in order to be used for hierarchy extraction.
*/
class SubclassExtractor(val f: FileLocator, pathWildcard: String) {
val files: Array[File] = f.FindJarArchives(pathWildcard).toArray
class SubclassExtractor(files: Array[File]) {
val p: Project[URL] = Project.apply(files, Array(org.opalj.bytecode.RTJar))
val classHierarchy: ClassHierarchy = p.classHierarchy

Expand Down