Checkstyle generate incompleted XML report - checkstyle

I run Checkstyle with Ant. Some projects work correctly, however, there's one project with very strange result. The XML report is not completed, no end tag and in the last line, the full path of JAVA file is not commpleted.
I copy some lines to here, after hide some sensitive information:
<?xml version="1.0" encoding="UTF-8"?>
<checkstyle version="8.43">
<file name="D:\projects\service-impl\src\com\a\b\c\d\e\f\v1_0\identification\impl\AServiceAdapterImpl.java">
</file>
<file name="D:\projects\service-impl\src\com\a\b\c\d\e\f\v1_0\identification\impl\sdo1.java">
</file>
<file name="D:\projects\service-impl\src\com\a\b\c\d\e\f\v1_0\identification\impl\dto2.java">
</file>
<file name="D:\projects\service-impl\src\com\a\b\c\d\e\f\v1_0\identification\impl\sdo3.java">
</file>
.....
And these last line of file:
<file name="D:\projects\service-impl\test\com\a\b\x\y\z\international\converter\convert1.java">
</file>
<file name="D:\projects\service-impl\test\com\a\b\x\y\z\international\converter\XConverterTest.java">
</file>
<file name="D:\projects\service-impl\test\com\a\b\x\y\z\international\con
No end tag, the last line is not completed.
And no thing show ion console.
How can I fix it

Solved, the new Checkstyle version don't support UTF8 method name/field name. After rename those variable, it works!

Related

How to update a regular C++ project to a CUDA runtime project in VS?

How can I update a regular VC++ project into a CUDA runtime project in Visual Studio 2019?
I tried to add the CUDA markups of the vcxproj project file, without success.
I'm expecting to see the CUDA/C++ tree in project properties.
In <Project DefaultTargets="Build" there should be:
<PropertyGroup>
<CUDAPropsPath Condition="'$(CUDAPropsPath)'==''">
$(VCTargetsPath)\BuildCustomizations</CUDAPropsPath>
</PropertyGroup>
it defines the variable CUDAPropsPath used further.
In the same <Project :
<ImportGroup Label="ExtensionSettings">
<Import Project="$(CUDAPropsPath)\CUDA 10.1.props" />
</ImportGroup>
add the default parameters of CUDA/C++ and CUDA/linker in project properties.
For all the .cu files, we need in <ItemGroup> with the other cpp files:
<CudaCompile Include="MyKernel0.cu"/>
And in <ImportGroup Label="ExtensionTargets"> there must be:
<Import Project="$(CUDAPropsPath)\CUDA 10.1.targets" />
that adds the CUDA/C++ and CUDA/linker in project properties.

How do I remove the "Set as StartUp Object" designation on an SSIS package?

It's easy to right-click and set a package as the startup object in an SSIS 2005 solution.
When it comes to removing that option, I could find nothing. There were dozens of pages on adding it, but nothing on removing it. After poking around all afternoon, I found that if I go to the "XXXXX.dtproj.user" file in the main solution folder, I can remove the "StartObjectID" tag in a text editor to accomplish this.
<?xml version="1.0" encoding="utf-8"?>
<DataTransformationsUserConfiguration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Configurations>
<Configuration>
<Name>Whatever</Name>
<Options>
<StartObjectID>Whatever.dtsx</StartObjectID>
<UserIDs />
<UserPasswords />
<OfflineMode>false</OfflineMode>
</Options>
</Configuration>
</Configurations>
</DataTransformationsUserConfiguration>
Is there a more obvious way to remove "Set as StartUp Object" from an SSIS package?
Right click solution folder ---> Configuration Properties---> Debugging----->Start Action
Set the start object id to Active Package

NoClassDefFoundError when checkstyle is running

I have written a new checkstyle check as a filescanner. I modeled my junits after the code I found in the checkstyle code. The junits run just fine and everything looks good.
But then, I add the check to my project.
<module name="TreeWalker">
<property name="tabWidth" value="4" />
<module name="com.onuspride.codetools.checkstyles.DuplicateClassNames"/>
</module>
and my ant task
<taskdef resource="checkstyletask.properties">
<classpath refid="classpath" />
</taskdef>
<property name="checkstyle.suppressions.file" value="checkstyle/suppressions.xml" />
<property name="translation.severity" value="error" />
<target name="checkStyle" description="TestTask to evaluate the checkstyle system.">
<checkstyle config="checkstyle/checkstyle_checks.xml">
<fileset dir="${msg.src}" includes="**/*.java" />
<formatter type="plain" />
<formatter type="xml" toFile="${msg.build.jar}/checkstyle_errors.xml" />
<classpath refid="classpath" />
</checkstyle>
</target>
the duplicateclassnames class calls several classes in the same jar. For some reason, when ant runs it, ant finds the check class, but can't find the supporting classes, when they are all in the same jar file. here's what i get in ant
[checkstyle] [class]:0: Got an exception - java.lang.NoClassDefFoundError: com/onuspride/codetools/common/classpath/criteria/ClassNameCriteriaCollector
Im stumped. Ive checkd all the dependencies of my jar, they are all in the classpath, I don't understand how it can find one class file but not another in the same jar. Ive done all my dirty little tricks and I just don't get it.
any ideas?
You can do it like following :
Create plugin project and add your custom checks there.
Make appropriate changes to plugin.xml, checkstyle_packages.xml.
Export the project as Deployable Plug-ins and fragments (Export > Plug-in Developement)
Copy the jar file to Eclipse Plugin folde, so no need to install your custom check .
You can go through this tutorial for reference
To reduce effort, download a Sample Check, the file is here under the name net.sf.eclipsecs.sample
Just replace your source in src folder. Before replacing, refer this 3 files in src/net/sf/eclipsecs/sample/checks/ directory as you will need them in your com/onuspride/codetools/checkstyles/ directory :
checkstyle-metadata.properties
checkstyle-metadata.xml
messages.properties
After replacing the code, make appropriate changes in checkstyle_packages.xml file in src/ directory.
Extending Check is described nicely there.

Overriding/merging standard programmatic configuration with config file section

We have a standard set of conventions that we follow for logging from our various applications, and it is sensible to package this configuration as by-code configuration and include in a common assembly.
Occasionally, however, we need to override this config to more efficiently debug production issues. This is more easily accomplished by letting a developer or administrator add an NLog config section, which can be read in and override or add to configuration done programmatically.
Can this be done out of the box with NLog?
I know this isn't by-code (I'm not sure how to do it), but you can use <include> with XML config to override things like variables. Here's a sample that uses Web.config that overrides the "standard" NLog.config for other projects:
Web.config:
<configuration>
<configSections>
<section name="nlog" type="NLog.Config.ConfigSectionHandler, NLog" />
</configSections>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<include file="${basedir}\bin\NLog.config" />
<variable name="fruit" value="Apples" />
</nlog>
</configuration>
NLog.config (that gets copied to bin):
<?xml version="1.0"?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<targets>
<!-- Output Window -->
<target name="debug" xsi:type="Debugger" layout="${fruit}|${level:uppercase=true}|${logger}|${message}"></target>
</targets>
<rules>
<logger name="*" writeTo="debug" />
</rules>
</nlog>

Help Updating XML file using MSBuild Extensions 4 with namespaces

I'm having some trouble getting MSBuild extensions 4.0 to update an XML file once a namespace is involved.
When I have a simple XML file with no namespace then fine, but once i attempt to update an xml file that has a namespace set, then nothing happens .. notice there is no error tho.
Here are the simple ones that work fine
<Project>
<PropertyGroup>
<ApplicationVersion>5.1.500.16</ApplicationVersion>
</PropertyGroup>
<PropertyGroup>
<ApplicationVersion>old</ApplicationVersion>
</PropertyGroup>
</Project>
and project file
<Project ToolsVersion="4.0" DefaultTargets="Default" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<TPath>C:\Program Files\MSBuild\ExtensionPack\4.0\MSBuild.ExtensionPack.tasks</TPath>
<AssemblyVersion>5.1.500.18</AssemblyVersion>
</PropertyGroup>
<Import Project="$(TPath)"/>
<Target Name="Default">
<MSBuild.ExtensionPack.Xml.XmlFile TaskAction="RemoveElement" " File="c:\build\test.csproj" XPath="/Project/PropertyGroup[1]/ApplicationVersion" />
</Target>
</Project>
Wheras these dont do anything !
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://mynamespace">
<PropertyGroup>
<ApplicationVersion>5.1.500.16</ApplicationVersion>
</PropertyGroup>
<PropertyGroup>
<ApplicationVersion>old</ApplicationVersion>
</PropertyGroup>
</Project>
and
<Project ToolsVersion="4.0" DefaultTargets="Default" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<TPath>C:\Program Files\MSBuild\ExtensionPack\4.0\MSBuild.ExtensionPack.tasks</TPath>
<AssemblyVersion>5.1.500.18</AssemblyVersion>
</PropertyGroup>
<Import Project="$(TPath)"/>
<ItemGroup>
<Namespaces Include="Mynamespace">
<Prefix>me</Prefix>
<Uri>"http://mynamespace"</Uri>
</Namespaces>
</ItemGroup>
<Target Name="Default">
<MSBuild.ExtensionPack.Xml.XmlFile TaskAction="RemoveElement" Namespaces="#(Namespaces)" File="c:\build\test.csproj" XPath="//me:Project/PropertyGroup[1]/ApplicationVersion" />
</Target>
</Project>
So what's the deal ? what am i missing ? Is it the formatting of the XPath in the second instance ? I've tried all kinds of variations.
Try this:
<Target Name="Default">
<MSBuild.ExtensionPack.Xml.XmlFile TaskAction="RemoveElement" Namespaces="#(Namespaces)" File="c:\build\test.csproj" XPath="//me:Project/me:PropertyGroup[1]/me:ApplicationVersion" />
</Target>
(namespace prefix before each xpath element)
In addition to the advice given in the other answer, remove the quotes from the Uri metadata in the Namespace item.
Note that according to the note for the prefix parameter in the MSDN documentation, specifing the empty string for the Prefix metadata will never work.