Untergeordnete Seiten
  • CodeCleanup

  Wiki Navigation

    Loading...


 Recently Updated


 Latest Releases

 MediaPortal 1.36
            Releasenews | Download
 MediaPortal 2.5
            Releasenews | Download



Table of Contents

Overview

The CodeCleanup utility is able to perform different tasks or reports issues related to the coding style or code comments.

Usage

Source code location: MediaPortal 2 repository \ MediaPortal\Tools\CodeCleanup

 

Root source directory: This is the directory, which is being searched recursively for code issues.

Blacklist (filename: blacklist.txt): It is possible to define a list of folders, which are not checked for code issues. i.e. source code from other projects

Tasks

Update copyright header

You can specify an old copyright header and a new copyright header.

filename: header.old.txt

The header which will be searched for.

filename: header.new.txt

The header which will be used to add / replace the existing headers.

The beginning of all *.cs files within the root source dir is checked against the specified headers.

  • If the new header, everyhing is fine. Nothing is done.
  • If the old header is found, it is being replaced by the new one.
  • if another header (no header) is found, it is being reported to the log list box.

 

The following files are not checked:

  • AssemblyInfo.cs -> No copyright header should be added to these files. There is another task for those files.
  • VersionInfo.cs -> No copyright header should be added to this file.
  • *.Designer.cs -> No copyright header should be added to these files.

Check AssemblyInfo.cs

This task can be used to check the AssemblyInfo.cs files. During this task no files are changed. This needs to be done manually.

Allowed header and footer can be specified by adding additional files right besides the CodeCleanup.exe.

I.e. AssemblyInfo.Footer.{n}.txt or AssemblyInfo.Header.{n}.txt where n can be counter to specify different headers and footers, which are allowed.

Within MP2 i.e. all AssemblyVersion attributes are derived from the global VersionInfo.cs, so no AssemblyInfo,cs is allowed to contain the version attributes (except those in blacklisted directories).

Another use case can be to check the inline comments. Creating projects using a German Visual Studio, also creates the inline comments within the AssemblyVersion in German, which should be prevented as much as possible. So the header/footer definition could included the English comments and thus ensure, non-English inline comments are reported to the log.

Potential improvements

  • task for checking csproj-files for obsolete elements
    • Bootstrapper
    • OldToolsVersion
    • Framework3.5 (for core)
    • pre-post-build events
    • xml / xaml files with Designer
    • FileUpgradeFlags
    • StartupObject
    • TargetFrameworkProfile
    • MSBuildToolsPath instead of MSBuildBinPath
  • empty line at eof
  • line endings
  • tabs & spaces
  • german vs. english code comments
  • latest resharper .dotsettings

   

 

This page has no comments.