Skip to content

Commit a83fcf6

Browse files
authored
Merge pull request #25 from Copyleaks/AI-code-detection-sunset-v2
display warning message for relevant users
2 parents 12ff3e0 + 0f2d31f commit a83fcf6

File tree

10 files changed

+113
-11
lines changed

10 files changed

+113
-11
lines changed

lib/copyleaks/ai_detection_client.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2222
# SOFTWARE.
2323
# =
24+
require_relative 'deprecationService.rb'
2425

2526
module Copyleaks
2627
class AIDetectionClient
@@ -45,7 +46,7 @@ def submit_source_code(authToken, scanId, submission)
4546
end
4647

4748
ClientUtils.verify_auth_token(authToken)
48-
49+
Copyleaks::DeprecationService.show_deprecation_message
4950
path = "/v2/writer-detector/source-code/#{scanId}/check"
5051

5152
headers = {

lib/copyleaks/api.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
require_relative 'ai_detection_client.rb'
2828
require_relative 'writing_assistant_client.rb'
2929
require_relative 'text_moderation_client.rb'
30+
require_relative 'deprecationService.rb'
3031
require_relative 'utils/copyleaks_client.utils'
3132

3233
module Copyleaks
@@ -113,6 +114,14 @@ def submit_file(authToken, scanId, submission)
113114
end
114115

115116
verify_auth_token(authToken)
117+
file_extension = File.extname(submission.filename).delete_prefix('.')
118+
119+
if file_extension.empty?
120+
raise ArgumentError, "File extension could not be determined for filename: #{submission.filename}"
121+
end
122+
if Copyleaks::SupportedFilesTypes::SUPPORTED_CODE_EXTENSIONS.include?(file_extension)
123+
Copyleaks::DeprecationService.show_deprecation_message
124+
end
116125

117126
path = "/v3/scans/submit/file/#{scanId}"
118127

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#
2+
# The MIT License(MIT)
3+
#
4+
# Copyright(c) 2016 Copyleaks LTD (https://copyleaks.com)
5+
#
6+
# Permission is hereby granted, free of charge, to any person obtaining a copy
7+
# of this software and associated documentation files (the "Software"), to deal
8+
# in the Software without restriction, including without limitation the rights
9+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
# copies of the Software, and to permit persons to whom the Software is
11+
# furnished to do so, subject to the following conditions:
12+
#
13+
# The above copyright notice and this permission notice shall be included in all
14+
# copies or substantial portions of the Software.
15+
#
16+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
# SOFTWARE.
23+
# =
24+
module Copyleaks
25+
class DeprecationService
26+
def self.show_deprecation_message
27+
28+
warn "DEPRECATION NOTICE: AI Code Detection will be discontinued on August 29, 2025. Please remove AI code detection integrations before the sunset date."
29+
30+
print "\033[31m"
31+
puts "════════════════════════════════════════════════════════════════════"
32+
puts "DEPRECATION NOTICE !!!"
33+
puts "AI Code Detection will be discontinued on August 29, 2025."
34+
puts "Please remove AI code detection integrations before the sunset date."
35+
puts "════════════════════════════════════════════════════════════════════"
36+
print "\033[0m"
37+
end
38+
end
39+
end
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#
2+
# The MIT License(MIT)
3+
#
4+
# Copyright(c) 2016 Copyleaks LTD (https://copyleaks.com)
5+
#
6+
# Permission is hereby granted, free of charge, to any person obtaining a copy
7+
# of this software and associated documentation files (the "Software"), to deal
8+
# in the Software without restriction, including without limitation the rights
9+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
# copies of the Software, and to permit persons to whom the Software is
11+
# furnished to do so, subject to the following conditions:
12+
#
13+
# The above copyright notice and this permission notice shall be included in all
14+
# copies or substantial portions of the Software.
15+
#
16+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
# SOFTWARE.
23+
# =
24+
25+
require_relative 'supportedFilesTypes.rb'
26+
27+
module Copyleaks
28+
end
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
module Copyleaks
2+
class SupportedFilesTypes
3+
SUPPORTED_CODE_EXTENSIONS = [
4+
"ts",
5+
"py",
6+
"go",
7+
"cs",
8+
"c",
9+
"h",
10+
"idc",
11+
"cpp",
12+
"hpp",
13+
"c++",
14+
"h++",
15+
"cc",
16+
"hh",
17+
"java",
18+
"js",
19+
"swift",
20+
"rb",
21+
"pl",
22+
"php",
23+
"sh",
24+
"m",
25+
"scala",
26+
"rs",
27+
"vbs",
28+
"css"
29+
].freeze
30+
end
31+
end

lib/copyleaks/models/index.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2222
# SOFTWARE.
2323
# =
24-
24+
require_relative 'constants/index.rb'
2525
require_relative 'exceptions/index.rb'
2626
require_relative 'exports/index.rb'
2727
require_relative 'submissions/index.rb'

lib/copyleaks/models/submissions/file_submission_model.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ class CopyleaksFileSubmissionModel < CopyleaksSubmissionModel
2626
# @param [String] base64 A base64 data string of a file. If you would like to scan plain text, encode it as base64 and submit it.
2727
# @param [String] filename The name of the file as it will appear in the Copyleaks scan report Make sure to include the right extension for your filetype.
2828
# @param [SubmissionProperties] properties Check inner properties for more details.
29+
attr_reader :base64, :filename, :properties
30+
2931
def initialize(base64, filename, properties)
3032
unless base64.instance_of?(String)
3133
raise 'Copyleaks::CopyleaksFileSubmissionModel - base64 - base64 must be of type String'

lib/copyleaks/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module Copyleaks
2-
VERSION = '3.6.1'
2+
VERSION = '3.7.0'
33
end

plagiarism-checker-3.7.0.gem

32 KB
Binary file not shown.

plagiarism-checker.gemspec

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,6 @@ Gem::Specification.new do |spec|
1919
spec.metadata['homepage_uri'] = spec.homepage
2020
spec.metadata['source_code_uri'] = 'https://github.com/Copyleaks/Ruby-Plagiarism-Checker'
2121
spec.metadata['changelog_uri'] = 'https://github.com/Copyleaks/Ruby-Plagiarism-Checker/releases'
22-
spec.post_install_message = <<-MSG
23-
\e[33m===============================================================
24-
DEPRECATION NOTICE: plagiarism-checker v#{Copyleaks::VERSION}
25-
===============================================================
26-
AI Code Detection will be discontinued on August 29, 2025.
27-
Please remove AI code detection integrations before the sunset date.
28-
===============================================================\e[0m
29-
MSG
3022

3123
spec.files = Dir.chdir(File.expand_path(__dir__)) do
3224
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:demo|test|spec|features)/}) || f.match(/\.gem/) }

0 commit comments

Comments
 (0)