spdx-online-tools
spdx-online-tools copied to clipboard
Limit code repetition in license namespace section
Since the license request and license namespace section of the SPDX online tools is quite similar in functionality. Both of these section provides the user the ability to submit license requests or license namespace, But to a different repository. Some of the code of namespaces is quite similar to that of license request, We could have easily adapted our code to use license request code to limit code repetition.
Code repetition means we will have to test that code as well, make changes at both the places, similar js files take up space, and load time it slows down the website due to more HTTP requests.
Some egs of code repetition-
- Like these two functions https://github.com/spdx/spdx-online-tools/blob/8d1d83b530e56dbac0928e86bf3e064e3cba49e1/src/app/views.py#L1576 https://github.com/spdx/spdx-online-tools/blob/8d1d83b530e56dbac0928e86bf3e064e3cba49e1/src/app/views.py#L1630
- Similarly, the files
script.js
andns_script.js
are quite similar.
Hi, may I work on this issue?
@tomokos2 Yes, you can. You don't need to be an assignee to work on the issue.
@rtgdk Hi, I was thinking about how to solve the similarity issue in script.js
and ns_script.js
--
- Have 3 files, one holding the similar code and the other two holding the different code, and load two scripts each in
editor.html
andns_editor.html
. - Combine the two files into one and have if statements that control which functions to use for the normal script and the namespace script? May I have your thoughts on these solutions? Is there one that would be preferable? Thank you.
@tomokos2 The 1st option looks fine to me. Having a common template that contains common functions and elements will be the way to go.