Excluding Files and Folders from dupFinder - resharper

I'm trying to use dupFinder to scan for duplications in a .NET codebase. I have certain files and folders that I want to exclude from the scan but I'm struggling to get it working.
The command I'm running is:
dupfinder.exe --show-text --output="dupReport.xml" --exclude="Some.Folder.*;*Resource.designer.cs" MyCode.sln
So what I'm trying to do is:
Scan the MyCode.sln solution.
Ignore all folders matching the pattern Some.Folder.* e.g. Some.Folder.Code and Some.Folder.Tests (these folders are in the root of the repository alongside the solution file).
Ignore all files matching the pattern *Resource.designer.cs in any folder i.e. MyCode.Resource.designer.cs.
I'm sure I'm just doing something wrong but the dupFinder documentation doesn't show an example of using the exclude option.

I have eventually managed to get this working, the conclusion I've drawn is that you can't exclude folders only files.
I think because my original exclude pattern was trying to ignore folders the whole thing wasn't working.

I know this is an old question but I also searched for this.
To exclude complete folders you should use double *
e.g.
--exclude="**\Tests\**;**\Resource.designer.cs"
excludes all Files in all Tests folders and Resource.designer.cs in whatever folder.
Edit:
Tested and still working on JetBrains.ReSharper.CommandLineTools.2020.3.4. Which was the current version when I wrote the answer.
Current version seems to have a bug again and not excluding at all.

Related

How to skip certain files when running `cookiecutter --replay`?

If I make a change to my cookiecutter template I like to use cookiecutter --replay (or --replay-file) to update my existing projects with the new template changes. When doing this, how can I skip certain files?
For example one thing my template contains is a requirements/ directory containing Python requirements files:
requirements/
main.in
main.txt
tests.in
tests.txt
It's useful for the template to output a starter set of requirements files when generating a new project. But the project will almost certainly modify these files whenever it adds or upgrades requirements so when replaying the template I would not want to overwrite the requirements files with the original starter ones. That would just delete any dependencies that've been added to the project since its inception.
I'm aware of --skip-if-file-exists but I don't want to skip all existing files, only the ones in the requirements/ dir.
The only solution that comes to mind immediately is to omit the requirements dir from the project template and use a post-generate hook to write out the starter requirements files only if they don't already exist.
But I wonder if there's a way to get cookiecutter to do this for me, without having to write it in Python myself?
For example is there some way to give cookiecutter --replay a list of files and directories to skip if they already exist?

How to use .htaccess to reformat a directory listing while including the directory name?

For directory listings, I've created a common .htaccess file as well as a common header ("HeaderName /header.html).
Everything works fine, except one thing: while I don't want the derpy h1 version of "Index of /blah", I'd like to display a customized (and normal-sized) version of that, e.g., "CurDir = /blah". By default, specifying the HeaderName replaces all of that with some static text.
I tried embedding a bit of PHP (getcwd()) but that just returned the root directory where the header.html lives, no matter what subtree was being displayed. Surely there's some way to access the CWD without having to sprinkle control files like this in each subfolder?
I stumbled upon what may be a suitable environment variable while looking at the phpinfo() output... but is there a better (more common) way people handle this, perhaps without even using PHP?
<?php
$dir = getenv("REQUEST_URI");
?>

Only branching specific folders and preserving their directory structure

I'm trying to create a branch spec that only pulls down specific folders from a repository, but preserves the directory structure.
For instance, in the repo the project looks like this:
project
->1.0
->Common
->ProjectSpecific
->Project1
.Project specific files
->Project2
.Project specific files
->2.0
.
.
.
->_env
.
.
.
->c
.
.
.
->setup
.
.
.
.general project files
What I'm trying to do is create a branch for each project that pulls down all folders, except in the 1.0/Project sub directory, it should only pull down the Project folder specific to that folder. I'm guessing this isn't possible purely with a branch spec (I've tried and always end up with everything in the same directory or other problems). I've tried creating a seperate codeline with a client view, mapping every directory under project, and beign sure to only map the Project specific folder, but it didn't work, and I'd really like to avoid having to create a new codeline for every project.
Is their a way to do this from a branch spec? Alternatively, is there a way to blacklist folders? Then I could simply map the whole project directory and just blacklist the projects I'm not interested in. Any help would be appreciated. If I'm not being clear, let me know and I'll add more detail.
Thanks
You can blacklist folders by adding a minus to the beginning of the line for the mapping in the branch spec.
See the Perforce documentation on Views for the gory details.
Right, you can use branch specs to include/exclude what you want. Streams provide an even simpler way to specify the files you want.

Best practice for white-labeling a static web site?

I have a directory structure with files under directory 'web', which represents a white-label web site (html files, images, js etc.).
I also have some twenty different 'brands' let's call them 'web-1', 'web-2' etc. each containing specific files that should override the files in 'web' for a specific brand.
Apache is configured to find the files for each virtual site i in document root 'website-i'.
In order for each 'website-i' to contain content like 'web' with the overrides for brand 'web-i', my build script first copies all of 'web' to 'website-i' and then overrides it with the source files from 'web-i'.
There several problems with this approach:
It takes time to copy the files.
It takes a lot of disk space
Adding a new brand requires adding to the script.
Is there a best practice for doing this in a way that does not require duplicating files?
(with Apache and Linux)
Well, the best solution is with pretty simple server-side code but I'm going to assume you've already rejected that, maybe because you haven't permission to run code on the server (although if your hacking the config then you probably do).
A solution just in config could be to make it serve from the default root but rewrite the url if the file exists in the proper dir ...
RewriteCond /web-1/a_file -f
RewriteRule ^(.*)$ /web/$1
But you'd have to do this for every file in every brand. You might be able to be more clever about it if the files are stored in a dir that's the same as the hostname but that's getting too complex for me.
Seriously, server-side code is the way to go on this...
Strangely enough, a work colleague was in pretty much exactly the same situation a couple of weeks ago and he eventually rewrote it as PHP. Each site is a row in a database, one page which pulls out the changed text and urls for images, etc. and falls back to a default if there's nothing there.
Having said all that. Using links, as you say above, solves problem 2, probably much of 1 and I don't think there's a way around 3 any way.

checking for modifications issues

I got a doubt regarding the usage of ccnet with clear case.I just
got an access to my clear case,i am facing another problem.I have a
VOB named Test_proj which contains many folders which are not of my
concern.Inside that particular VOB,i had made a test folder named
'MY_Source',where i had put all my source files.So when i ran the
ccnet,i found that its checking for mdifications for all the folders
which is really not needed.I just need my ccnet to check for
modifications in that particular folder which is MY_Source.So is there
any other tag which i need to mention along with the viewpath which
just checks for modfication in the particular folder in the VOB rather
than the whole VOB.
2.If it finds any modifications,it should also download the whole
source files and start the compilation process.So how can this be
configured in ccnet.
Thanks and regards
Maddy
Here's a sample config. block I use for ClearCase:
<sourcecontrol type="clearCase">
<viewPath>Y:\Mobi-Info\Source\Components</viewPath>
<autoGetSource>true</autoGetSource>
<useLabel>false</useLabel>
<branch>main</branch>
</sourcecontrol>
viewPath specifies the root directory inside your ClearCase view which you want to be checked for modifications (in my case the Components directory). So if you want CCNet to react only to your MY_Source directory modifications, point directly to it in the viewPath.

Resources