This repository was archived by the owner on Feb 12, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 17
Saving more file information in the models #90 #93
Open
singh1114
wants to merge
4
commits into
aboutcode-org:develop
Choose a base branch
from
singh1114:addFileInfo
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
fe4936a
Saving more file information in the models #90
singh1114 8ec8a9c
Change test cases to pass the build #90
singh1114 2ff6a0e
Add a function to fill rest of the ScannedFile model #90
singh1114 d4b1737
Add a newline to solve the travis problem
singh1114 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -104,6 +104,87 @@ def __str__(self): | |
|
|
||
| scan = models.ForeignKey(Scan) | ||
| path = models.CharField(max_length=400, help_text='Path of file scanned') | ||
| type = models.CharField(max_length=400, help_text='Type of the entity being scanned') | ||
| name = models.CharField(max_length=400, help_text='Name of the entity being scanned') | ||
| base_name = models.CharField( | ||
| max_length=400, | ||
| help_text='Base name of entity without extension', | ||
| ) | ||
| extension = models.CharField( | ||
| max_length=400, | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 400 seems to be big for a field that just stores the file extension. This can be changed to something smaller. You should also take a look at other field sizes and make them smaller.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK. |
||
| help_text='Extension of the entity being scanned', | ||
| null=True, | ||
| blank=True | ||
| ) | ||
| date = models.DateTimeField( | ||
| help_text='Date of entity being created', | ||
| null=True, | ||
| blank=True | ||
| ) | ||
| size = models.IntegerField( | ||
| help_text='Size of the entity being scanned', | ||
| null=True, | ||
| blank=True | ||
| ) | ||
| sha1 = models.CharField( | ||
| max_length=400, | ||
| help_text='SHA1 Checksums of the file', | ||
| null=True, | ||
| blank=True | ||
| ) | ||
| md5 = models.CharField( | ||
| max_length=400, | ||
| help_text='MD5 checksums of the file', | ||
| null=True, | ||
| blank=True | ||
| ) | ||
| files_count = models.IntegerField( | ||
| help_text='number of files present if a directory', | ||
| null=True, | ||
| blank=True | ||
| ) | ||
| mime_type = models.CharField( | ||
| max_length=400, | ||
| help_text='mime type of entity being scanned', | ||
| null=True, | ||
| blank=True | ||
| ) | ||
| file_type = models.CharField( | ||
| max_length=400, | ||
| help_text='file type of entity being scanned. null if the entity is a directory', | ||
| null=True, | ||
| blank=True | ||
| ) | ||
| programming_language = models.CharField( | ||
| max_length=400, | ||
| help_text='programming language used in the entity', | ||
| null=True, | ||
| blank=True | ||
| ) | ||
| is_binary = models.BooleanField( | ||
| help_text='Whether the entity being scanned is binary or not', | ||
| default=False | ||
| ) | ||
| is_text = models.BooleanField( | ||
| help_text='Whether the entity being scanned has text or not', | ||
| default=False | ||
| ) | ||
| is_archive = models.BooleanField( | ||
| help_text='Whether the entity being scanned is archive or not', | ||
| default=False | ||
| ) | ||
| is_media = models.BooleanField( | ||
| help_text='Whether the entity being scanned is media file or not', | ||
| default=False | ||
| ) | ||
| is_source = models.BooleanField( | ||
| help_text='Whether the entity being scanned is source or not', | ||
| default=False | ||
| ) | ||
| is_script = models.BooleanField( | ||
| help_text='Whether the entity being scanned is a script file or not', | ||
| default=False | ||
| ) | ||
|
|
||
|
|
||
| class License(models.Model): | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At the moment, there is no proper documentation of what the fields are in ScanCode, so we may use this help text as a definition for the fields. Thanks for getting it started for us!
That said, there can be some improvements made to the text to make it more accurate. For example, in the case of type, it should just say "Type of resource: file or directory". Do not use "entity" as anything we scan is either a file or a directory. Also remove "being scanned" from the text, it is not necessary.
Some other suggestions:
name: "Name of the file or directory"
date: "Creation date of file or directory"
etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, that seems fair...