Skip to content

Commit 132ad6a

Browse files
authored
Merge pull request #578 from BBasile/init-mod-name
Use new config name override instead of breaking existing ini merged-on-behalf-of: Sebastian Wilzbach <sebi.wilzbach@gmail.com>
2 parents 2c82155 + 67e0f8a commit 132ad6a

File tree

5 files changed

+5
-49
lines changed

5 files changed

+5
-49
lines changed

.dscanner.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
; Configure which static analysis checks are enabled
2-
[dscanner.analysis.config.StaticAnalysisConfig]
2+
[analysis.config.StaticAnalysisConfig]
33
; Check variable, class, struct, interface, union, and function names against t
44
; he Phobos style guide
55
style_check="disabled"

dub.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"dependencies" : {
1515
"libdparse": "~>0.8.0-alpha.5",
1616
"dsymbol" : "~>0.3.0-alpha.3",
17-
"inifiled" : "~>1.1.0",
17+
"inifiled" : "~>1.2.0",
1818
"emsi_containers" : "~>0.6.0",
1919
"libddoc" : "~>0.3.0-beta.1",
2020
"stdx-allocator" : "~>2.77.0"

src/dscanner/analysis/config.d

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ StaticAnalysisConfig disabledConfig()
5454
return config;
5555
}
5656

57-
@INI("Configure which static analysis checks are enabled")
57+
@INI("Configure which static analysis checks are enabled", "analysis.config.StaticAnalysisConfig")
5858
struct StaticAnalysisConfig
5959
{
6060
@INI("Check variable, class, struct, interface, union, and function names against the Phobos style guide")

src/dscanner/main.d

Lines changed: 1 addition & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ else
6868
bool printVersion;
6969
bool explore;
7070
string errorFormat;
71-
bool patchConfig;
7271

7372
try
7473
{
@@ -97,8 +96,7 @@ else
9796
"muffinButton", &muffin,
9897
"explore", &explore,
9998
"skipTests", &skipTests,
100-
"errorFormat|f", &errorFormat,
101-
"patchConfig", &patchConfig);
99+
"errorFormat|f", &errorFormat);
102100
//dfmt on
103101
}
104102
catch (ConvException e)
@@ -235,11 +233,7 @@ else
235233
StaticAnalysisConfig config = defaultStaticAnalysisConfig();
236234
string s = configLocation is null ? getConfigurationLocation() : configLocation;
237235
if (s.exists())
238-
{
239-
if (hasWrongIniFileSection(s, patchConfig))
240-
return 0;
241236
readINIFile(config, s);
242-
}
243237
if (skipTests)
244238
config.enabled2SkipTests;
245239
if (report)
@@ -472,41 +466,3 @@ string getConfigurationLocation()
472466

473467
return getDefaultConfigurationLocation();
474468
}
475-
476-
477-
/// Patch the INI file to v0.5.0 format.
478-
//TODO: remove this from v0.6.0
479-
bool hasWrongIniFileSection(string configFilename, bool patch)
480-
{
481-
import std.string : indexOf;
482-
import std.array : replace;
483-
484-
bool result;
485-
486-
static immutable v1 = "analysis.config.StaticAnalysisConfig";
487-
static immutable v2 = "dscanner.analysis.config.StaticAnalysisConfig";
488-
489-
char[] c = cast(char[]) readFile(configFilename);
490-
try if (c.indexOf(v2) < 0)
491-
{
492-
if (!patch)
493-
{
494-
writeln("warning, the configuration file `", configFilename, "` contains an outdated property");
495-
writeln("change manually [", v1, "] to [", v2, "]" );
496-
writeln("or restart D-Scanner with the `--patchConfig` option");
497-
result = true;
498-
}
499-
else
500-
{
501-
c = replace(c, v1, v2);
502-
std.file.write(configFilename, c);
503-
writeln("the configuration file `", configFilename, "` has been updated correctly");
504-
}
505-
}
506-
catch(Exception e)
507-
{
508-
stderr.writeln("error encountered when trying to verify the INI file compatibility");
509-
throw e;
510-
}
511-
return result;
512-
}

0 commit comments

Comments
 (0)