Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the Solidity language without an associated extension (updated) #3755

Closed
wants to merge 3 commits into from

Conversation

frangio
Copy link

@frangio frangio commented Aug 4, 2017

After the discussion in #3560 and following @pchaigno's suggestion in #3559, this PR adds the Solidity language, together with two sample files, but without associating an extension to it.

To sum things up, the associated .sol extension is shared by files on GitHub that don't correspond to a language, and it's impossible for a linguist heuristic to return that as a result. This is referred to as the not-a-language feature, which is apparently non-trivial to implement. In the meantine, we've agreed on adding the language without an extension, so that repositories can at least use .gitattributes overrides to get syntax highlighting.

Here's a Github search for the language with more than 25000 results.

One of the sample files is taken from OpenZeppelin, which is MIT licensed. The other one was written by @veox specifically to demonstrate the language syntax, and is BSD licensed.

@@ -0,0 +1,56 @@
pragma solidity ^0.4.11;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Travis CI build fails because of these samples. Files in samples/ are used by the Bayesian classifer and are expected to be registered in languages.yml (through their file extension or filename). Since it's not the case here, could you move these example files to tests/fixtures/?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure! Maybe there should be a note about that in the contributing guide.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a pretty rare case. It's only the second language we'd be adding that doesn't have an extension or a filename defined.

type: programming
ace_mode: text
tm_scope: source.solidity
language_id: 237469032
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a color for Solidity? We usually try to use colors from official logos if any.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logo only has dark shades of gray. I'm not sure it'll look very nice but I've set it to one of those.

frangio added 2 commits August 4, 2017 15:53
they're not used by the bayesian classifier
@frangio
Copy link
Author

frangio commented Aug 4, 2017

I'm not sure I understand what I'm supposed to do with the sample files. The Travis CI build is still failing.

@frangio
Copy link
Author

frangio commented Aug 4, 2017

Regarding the color, it seems to be too close to an existing one. I've tried all the colors of the logo and they're too close too. Would it be ok to submit without color, or should I make one up?

@veox
Copy link

veox commented Aug 6, 2017

EDITed (a lot):

For the color failure, perhaps any gray will work? I've tried a bunch, #777777 seems to be OK.

@veox
Copy link

veox commented Aug 6, 2017

From #3755 (comment):

The Travis CI build fails because of these samples. Files in samples/ are used by the Bayesian classifer and are expected to be registered in languages.yml (through their file extension or filename). Since it's not the case here, could you move these example files to tests/fixtures/?

From #3755 (comment):

It's a pretty rare case. It's only the second language we'd be adding that doesn't have an extension or a filename defined.

@pchaigno Would the first one be Data?

If so, does that mean that the test cases that are failing now (with "No language") would require special handling, like Data? For ref, here:

Add to appropriate lines:

if language == 'Data' || language == 'Solidity'

(That doesn't look very nice to me.)

@frangio
Copy link
Author

frangio commented Aug 25, 2017

@pchaigno Any thoughts?

@onbjerg
Copy link

onbjerg commented Sep 20, 2017

@veox @frangio The other language that doesn't have an extension or a filename defined is "Python Console" I think.

There's no fixtures or sample files for that language, so I suppose the only way to make this pass is to remove the fixtures (which feels scary).

The files in test/fixtures are also tested like the ones in samples: https://github.com/github/linguist/blob/b94e018c3af1ca5b3858f2249253d076b26df6a0/test/test_blob.rb#L256-L279

@Vishesh-Gupta
Copy link

Is there any update on this issue? I think linguist does not check for solidity currently.

@oktapodia
Copy link
Contributor

Thanks for this pull request, any update?

@lildude
Copy link
Member

lildude commented Jan 12, 2018

Closing in favour of #3973 which will add Solidity support with the .solidity extension and will then allow peeps to use an override for the .sol or any other extension.

@lildude lildude closed this Jan 12, 2018
@pchaigno pchaigno mentioned this pull request Mar 26, 2018
15 tasks
@github-linguist github-linguist locked as resolved and limited conversation to collaborators Jun 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants