Package org.sonar.plugins.python.indexer
Record Class ConfigSourceRoots
java.lang.Object
java.lang.Record
org.sonar.plugins.python.indexer.ConfigSourceRoots
- Record Components:
configFile- the configuration file from which the source roots were extractedrelativeRoots- the relative source root paths defined in the config file
Represents source roots extracted from a build configuration file (pyproject.toml or setup.py).
This record associates relative source root paths with the configuration file they were extracted from, allowing proper resolution of absolute paths relative to the config file's location rather than the project base directory.
-
Constructor Summary
ConstructorsConstructorDescriptionConfigSourceRoots(File configFile, List<String> relativeRoots) Creates an instance of aConfigSourceRootsrecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theconfigFilerecord component.static ConfigSourceRootsCreates a ConfigSourceRoots with an empty list of relative roots.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.Returns the value of therelativeRootsrecord component.Converts the relative source roots to absolute paths.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
ConfigSourceRoots
Creates an instance of aConfigSourceRootsrecord class.- Parameters:
configFile- the value for theconfigFilerecord componentrelativeRoots- the value for therelativeRootsrecord component
-
-
Method Details
-
toAbsolutePaths
Converts the relative source roots to absolute paths.Each relative path is resolved relative to the parent directory of the configuration file. For example, if the config file is at
/project/app/pyproject.tomland a relative root is"src", the absolute path will be/project/app/src.- Returns:
- list of absolute paths for the source roots
-
empty
Creates a ConfigSourceRoots with an empty list of relative roots.- Parameters:
configFile- the configuration file- Returns:
- a ConfigSourceRoots with no relative roots
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
configFile
Returns the value of theconfigFilerecord component.- Returns:
- the value of the
configFilerecord component
-
relativeRoots
Returns the value of therelativeRootsrecord component.- Returns:
- the value of the
relativeRootsrecord component
-