Github Repository Languages used not showing correct [duplicate] - github

GitHub search allows filtering repositories by language. How can I set a repository to a specific language?

You can also override certain files
$ cat .gitattributes
*.rb linguist-language=Java
Source

It is purely deduced from the code content.
As Pedro mentions:
Please note that we count the total bytes of each language's file (we check the extension) to decide the percentages.
This means that if you see your project reported a JavaScript, but you swear you use Ruby, you probably have a JS lib somewhere that is bigger than your Ruby code
As detailed in "GitHub changes repository to the wrong language", you can add a .gitattributes file in which you can:
ignore part of your project (not considered for language detection)
static/* linguist-vendored
consider part of your project as documentation:
docs/* linguist-documentation
indicate some files with specific extension (for instance *.rb) should be considered a specific language:
*.rb linguist-language=Java

You can also make some of the files vendor-ed. Just create a .gitattributes file in the main directory. If you want to exclude CSS from the language statistics write into the file something like this.
client/stylesheets/* linguist-vendored
This will hide all files in the client/stylesheets/ from the language statistics. In my case these are the .css files.
This solves your problem partly, because hides the most used language and choose the second one to be prime.

A bit brute-force, but I used this .gitattributes file:
* linguist-vendored
*.js linguist-vendored=false
It says to ignore all files except .js, so JavaScript becomes the only possible language. My project, https://github.com/aim12340/jQuery-Before-Ready, was listed as HTML and this changed it to JavaScript.

As VonC mentioned in the comments, you can put your libraries under "vendors" or "thirdparty" and the files won't be analysed by linguist, the tool GitHub uses to analyse the language in your code.
# Vendored dependencies
- third[-_]?party/
- 3rd[-_]?party/
- vendors?/
- extern(al)?/
Later, they added more folder names.

Create .gitattributes file in the root of your folder.
Suppose you want the language to be Java, just copy-paste
*.java linguist-detectable=true
*.js linguist-detectable=false
*.html linguist-detectable=false
*.xml linguist-detectable=false
in the .gitattributes file and push the file in the repository. Reload your GitHub page to see the language change.
For reference, use this GitHub repository.

Rename the name of the code files in your repository with the extension added.
For example:
change abc to abc.py for Python
abc to abc.java for Java files
abc to abc.html for HTML

Related

Projectile search only part of the project

When using emacs Projectile and helm-projectile, I am used to search for text inside the whole project. However is there a way to search only part of the project?
Something like:
search inside a subfolder only
search while excluding a subfolder
Yes you can exclude (sub) folders. Add a line in your .projectile:
-/sub/folder
So search inside a subfolder, I don't see something automatic. You could put project files in some subfolders (https://projectile.readthedocs.io/en/latest/configuration/#file-local-project-root-definitions) and switch projects.
For now I am using rgrep, which prompts for a string and a directory to find.
I would be happy to hear about an equivalent solution using ag, and I should mention I haven't yet dug into the link from #goromlagche (https://github.com/ggreer/the_silver_searcher#emacs).
Install helm-ag, this requires silversearcher-ag package; for debian apt install silversearcher-ag. And then you can
helm-do-ag to search inside a sub-folder/directory inside project
to ignore sub-folders/directories add them to either .gitignore or .hgignore if it is git and hg project respectively or add then to .projectile file, details here.
references:
https://github.com/emacsorphanage/helm-ag
https://github.com/ggreer/the_silver_searcher

How to have different file links to an Eclipse project (not importing it)?

I noticed when I import a file, the file is copied to the work space, but can I just create a file link in a Eclipse project? So when I modify the files in Eclipse, the files in the linked location is modified. In this way, I can version control the files using SVN. And I don't need to copy the modified files back to its dedicated directory when deployment.
The following is a more detailed description of my problem:
I have a cgi application located and runs in apache. The app runs with diff configuration files for different 'projects' which is more like showing different dataset with its corresponding configuration file. My task is to write the configurations files which will require some perl callback functions, css files and images. All these files have their own dedicated directories located in different places in the company server which i have not much control with.. So far, I just use command line to modify files and keeping old copies for version control. If I can do something like my above description, I will be able to have a central place to work on and do SVN. Or do you have a better idea how I should set up my work environment?
Thanks heaps in advance.
Yes you can,
File -> New File -> Advanced (at the bottom) -> Link to file in the file system
Manu
I have figured out a way to conveniently to version control files from different places and can deploy them to the correct directories after modified. It's ....... using..... the ANT build file... I just have all files imported to a single project and use an ANT build to distribute them back to their corresponding destination.
Use svn:external http://svnbook.red-bean.com/en/1.0/ch07s03.html
One drawback though, you have to update your other projects once you commit a shared files.

IntelliJ IDEA 9/10, what folders to check into (or not check into) source control?

Our team has just moved from Netbeans to IntelliJ 9 Ultimate and need to know what files/folders should typically be excluded from source control as they are not "workstation portable", i.e.: they reference paths that only exist on one user's computer.
As far as I can tell, IntelliJ wants to ignore most of the .idea project including
.idea/artifacts/*
.idea/inspectionProfiles/*
.idea/copyright/*
.idea/dataSources.ids
.idea/dataSources.xml
.idea/workspace.xml
However, it seems to want to check in the .iml files that exist in each module's root directory.
I originally checked in the entire .idea directory via the command line which is obviously not aware of what "should" be ignored by IDEA. Is the entire .idea directory typically ignored?
We have a FAQ article covering this question.
[The .idea] format is used by all the recent IDE versions by default.
Here is what you need to share:
All the files under .idea directory in the project root except the workspace.xml and tasks.xml files which store user specific settings
All the .iml module files that can be located in different module directories (applies to IntelliJ IDEA)
Be careful about sharing the following:
Android artifacts that produce a signed build (will contain keystore passwords)
In IDEA 13 and earlier dataSources.ids, datasources.xml can contain database passwords. IDEA 14 solves this problem.
You may consider not to share the following:
.iml files for the Gradle or Maven based projects, since these files will be generated on import
gradle.xml file, see this discussion
user dictionaries folder (to avoid conflicts if other developer has the same name)
XML files under .idea/libraries in case they are generated from Gradle or Maven project
.idea directory is a replacement for the old .ipr (Idea Project) file and if you want to share the project between users, then you need to share .idea folder (with the exceptions mentioned in the FAQ) and all the .iml files.
Refer to GitHub's JetBrains.gitignore file to always have an updated listing of which files to ignore.
Not an exact answer to the question, but there are sample .gitignore files available here, including one for JetBrains which includes IntelliJ.
You might find this post interesting: Merges on IntelliJ IDEA .IPR and .IWS files
It seems to conclude that you should add all files except for: workspace.xml, dataSources.xml, sqlDataSources.xml and dynamic.xml. The answer there is focusing on having files that do not change simply from opening the editor or making ide specific changes.
I'm using PHPStorm.
Here is an example snippet for your .gitignore
# Ignore the following 2 PHPStorm files only workspace and tasks file
**/.idea/workspace.xml
**/.idea/tasks.xml
All other files in the .idea directory should be committed to your repository.
e.g: (commit everything else in the .idea directory)
new file: .idea/.name
new file: .idea/encodings.xml
new file: .idea/framework.iml
...
Docs: How to manage projects under Version Control Systems
Here is what you need to share:
All the files under .idea directory in the project root except the workspace.xml and tasks.xml files which store user specific settings
All the .iml module files that can be located in different module directories (applies to IntelliJ IDEA)
So basically, commit everything except workspace.xml and tasks.xml.
Yes, I believe so. You can check the SVN configuration to see what's ignored and add anything that you think should be ignored.
IntelliJ now creates its own .gitignore file in the .idea folder so you can safely add it to repository.

Diff directories with content in Netbeans

I duplicated some folder with project's config to a new project a few days ago and made there some modifications (project name, paths, etc).
After few days a source config dir has changed and I am wondering how to diff that folders in 2 projects to apply that changes in new project.
If I select source file and then new file and select diff option in Netbeans - it works. But is it possible to make in on whole folder ?
I was looking for folder compare in NetBeans too. I found http://kenai.com/projects/netbeans-dircomp/downloads. I'll try that in a little while...
NetBeans does not have that feature.
You could probably hack together a shell script that would do this, based on find, etc. This search for 'diff a directory tree' looks like it has some good answer.
I would recommend that you put your source code under some sort of source code control system like CVS, SVN or Mercurial.
You could use those tools to generate a diff of the original project's config between the date you made the copy and 'now'... and then apply that diff onto the copy of the project...
Or, you could apply some of the strategies described in CVS manual for handling third party sources. I think the same concepts are available for svn and mercurial.
A very old question, but Netbeans does have a CVS feature now.
Go to Tools>Plugins and find CVS and install.
After that it is very easy to right click a directory, go to tools, then apply diff patch. That will patch all files in the diff file in that directory. Simple and smooth.
And You Can Also Use The
Total Commander
to Compare the folder and all type off your files
Its amazing in this situation

Resources check

hey I am frequently uploading my XCode iPhone projects to an svn repository to be build on another machine.
My problem is that when I add resources to my project sometimes I forget to add the resource as relative to the project.
I know one answer is to be more careful (not easy when your tired!) but if there was a way to run a script to check my resource paths are relative when I build and warn me if they are not it would be a great time saver for me.
How would I go about doing this?
Thanks
Chris
You can select all the files in your project and set the Path Type for all of them in one go. While this isn't a script this does save a lot of time over doing the files individually
I think the best approach to script this would be to look in the .xcodeproj file - the file paths are listed in there. If your project is called MyProject you need to open (either by using Show Package Contents in Finder or just the usual cd in Terminal) the MyProject.xcodeproj directory.
In here you'll find a file called project.pbxproj - open this in a editor that won't mess up your formatting and have a peek around the file. If you search for one of your files in the project you should be able to see how Xcode stores references to the project files.
Look for a section named /* Begin PBXFileReference section */. In here all your files are listed, along with where they are relative to the project, e.g.:
... path = Classes/MyClass.h; sourceTree = SOURCE_ROOT
If you can parse this file you should be able to acheive what you want - but remember to back up the file, otherwise you might corrupt your project.
How would it be if you instead write a script that asks the SCM if anything in the project is not committed? For example, think of this scenario
Project Root
Codex
Project.xcodeproj
…
Design
anImage.png
where anImage.png being outside of Codex, where the Xcode project sits (its path starts with a ../). A strong .pbxproj parser would have to support all the variants in which Xcode references files to know exactly if there are stray files.
OTOH, the SCM knows where everything is all the time (you mentioned up-ping to a SVN server), so why not ask it instead.
We have a Ruby script that prints a warning in Xcode’s Build Log if anything in the project is not committed.